Repository navigation
Description
Corrected after measuring (the first version of this body claimed the stream dangles open; it does not). An internal reload runs stopInternal, which tears the tap controller down and finishes the stream. A host's for await therefore ends, so the loss is observable. What remains is smaller than first written, and still worth closing.
What happens
installAudioTap() binds the software delivery path to the SoftwarePlaybackHost live at install time. An audio-track switch is a session-preserving reload: it goes through stopInternal(resetDisplayCriteria: false, keepNativeHost:, keepCustomReader: true), which runs audioTapController?.teardown(); audioTapController = nil, and then builds a new host with no sink.
So a transport-level call (selectAudioTrack) ends an opt-in feature the host installed at load, and nothing re-establishes it. Same for a subtitle-track switch, a title switch and reloadAtCurrentPosition, which take the same path.
The documented contract is that load() and stop() finish the stream, opt-in being per load. A host switching an audio track called neither.
The #311 frame-time observer crosses the identical seam and is deliberately carried across it (AetherEngine+Loading.swift, host.setVideoFrameTimeObserver(softwareVideoFrameTimeObserver), "a load builds a new host and a new renderer, so an observer installed once by the host app has to be carried across the seam"). The tap has no counterpart, and the asymmetry is not intentional as far as the history shows.
Measured
40 s MKV, three audio tracks, software path, tap installed at load, selectAudioTrack at +20 ms:
AUDIOTAP installed (deliverySource=true)
HOSTCALL selectAudioTrack(index: 3) at +20 ms (was 1)
AUDIOTAP stream finished (buffers=1)
Re-installing after the switch resumes delivery immediately (abufs 1 → 177), so nothing about the new session is hostile to the tap; it is only that nobody re-arms it.
aetherctl play --sw --seconds 8 --switch-audio 3@20 --audio-stats <multi-audio file>
Suggested shape
Carry the tap across the reload seam the way the frame-time observer is carried: hold the controller through a session-preserving stopInternal and re-arm the sink where the new host is built. A host that opted in at load then keeps its tap across a track switch, which is what the per-load contract already promises.
Failing that, document that a track switch ends the tap, so hosts re-install on stream end rather than discovering it.
Area
Software (VideoToolbox) playback path
Activity
[-]Audio tap goes silent after an audio-track switch: the sink is bound to the host the switch replaces[/-][+]Audio tap does not survive a session-preserving reload: a track switch ends it, nothing re-arms it[/+]diag(aetherctl): say when the audio tap's stream finishes
docs(audiotap): a session-preserving reload ends the tap, and why tha…
superuser404notfound commentedon Aug 9, 2026
Working through this, the case for carrying the tap across the seam got weaker the closer I looked, so what landed is the boundary made explicit rather than removed. @dlev02, since yours is the host actually on this API, the question at the end is for you.
Why not carry it across. Three things, in the order they moved me:
The "one line next to
setVideoFrameTimeObserver" I wrote above is only true for the software sink. The loopback reader is bound to the session'sSegmentCache(captured at install), and the remote-HLS reader toloadedURLplus the playhead mirror. A session-preserving reload rebuilds both sources, so carrying the controller would mean re-running the whole reader selection against the new host, with a backend that may have changed across the reload. That is a re-install withstopInternalsurgery in front of it, not a hand-off.The teardown is also the safer behaviour for the one use case this API was built for.
AudioTapMonotonicFilteris per controller, so every install starts a clean timeline. Carrying one across would meet a reload that resumes slightly behind the previous position with the oldlastEndstill latched, which is exactly the backward-overlap shape SpeechAnalyzer rejects withSFSpeechErrorDomain Code=17. That filter exists because of that error; re-introducing its input would be a poor trade for the convenience of not re-installing.And the asymmetry with #311 that I leaned on in the body does not really hold. The frame-time observer is a registration with no resources of its own, the tap is a pipeline with a lifetime tied to the session. One surviving the seam and the other not is a difference in kind, not an inconsistency.
What shipped instead (
main): the contract now says a session-preserving reload finishes the stream, oninstallAudioTap()and indocs/architecture.md, with the reason rather than just the rule. And the teardown has a log line that mirrors the install one, so a device log shows the boundary instead of a tap that was installed once and then went quiet:The question. Does your host already treat the stream ending as "re-install", and if so, is the gap across a track switch cheap for you, or does it cost transcript? If a switch is expensive on your side, the right fix is a real re-install against the new session driven by the engine, and that is worth building on a measurement rather than on my guess about how the tap is consumed. Keeping this open for that answer.
dlev02 commentedon Aug 11, 2026
Thanks for taking the time to dig into this and explain the tradeoff. Your reasoning makes sense, especially keeping a clean monotonic timeline instead of carrying the old filter state into a reloaded session.
I need to verify how Prism currently handles the tap stream ending across audio and subtitle track switches. Rather than assuming the engine should re-install it, I will test those reload paths on our side and see whether re-installing from the host is enough or whether it causes a meaningful transcript gap. I will report back with what I find.
The explicit contract and teardown log are already helpful. Thanks again for getting back to me.
docs: the API reference the README kept pointing at
superuser404notfound commentedon Sep 22, 2026
Housekeeping pass over the open tracker. Nothing here is owed by the engine, so this goes on the closed pile with one correction and an open invitation.
What shipped is the boundary made explicit rather than removed, in 6.18.0 (
cec57fd7), which the note above left untagged:installAudioTap()states the contract in its own doc comment (AetherEngine+AudioTap.swift:15-25), the teardown instopInternal(AetherEngine.swift:6595-6601) mirrors the install with a log line naming the reload, anddocs/api.mdcarries it. The decision not to re-arm stands on the reason given: the filter is per install, and carrying its state across the seam is the backward-overlap shapeSFSpeechErrorDomain Code=17rejects.One thing in the body that my own comment disproved and that the body still asserts: "the #311 frame-time observer crosses the identical seam, and the asymmetry is not intentional as far as the history shows". It is a difference in kind rather than an inconsistency, and anyone reading the body cold would take the original claim at face value.
@dlev02, the measurement you offered is the thing that would justify building an engine-driven re-install, and it is still the right way round: if a track switch turns out to cost Prism transcript, reopen this with the numbers rather than filing fresh, and the argument resumes with the evidence it was missing. Leaving it parked in the open column for that does not make it arrive any sooner.