5.23.1
The 5.23.0 session release blocked the teardown (#215)
Device test on an Apple TV 4K feeding an AVR, one day after 5.23.0 shipped: with deactivatesAudioSessionOnStop enabled, leaving an Atmos title froze the UI for about half a second before the dismiss animation started. Leaving 5.1 content dismissed instantly.
The difference is the route, not the content. setActive(false) is an XPC round trip to mediaserverd, and on an E-AC-3 / Atmos MAT bitstream-passthrough route the sink renegotiates the HDMI link inside that call. The same call on a 5.1 route costs a few milliseconds. Called inline from stopInternal, that cost lands on the main actor, and the host's dismiss cannot start until stop() returns.
The release now runs off the main actor just after the teardown. That is the same treatment setCategory got in #114, for the same reason: these calls are XPC round trips that have no business on the main thread. Unlike setCategory this one has to stay ordered against a following load(), so it is guarded by the load generation that stopInternal bumps: a load() starting in the meantime bumps it again and the pending release drops rather than deactivating the new session out from under the new item. stopInternal also cancels a pending release before scheduling another.
The call is timed in the log now, since the cost is route-dependent and that number is the entire reason it cannot be inline.
Hosts that leave the flag at its default false are unaffected, in 5.23.0 as well as here.
Covered by: 1060 tests green across 171 suites, macOS plus tvOS and iOS Simulator builds clean. Device-verified on the Apple TV 4K / AVR setup that surfaced it: Atmos titles now dismiss as instantly as 5.1 ones, with playback and Atmos passthrough unchanged.