Skip to content

fix(audio): the audio-only host parks its clock at end of media (#694) - #698

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/694-audio-host-end-park
Oct 4, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/694-audio-host-end-park

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Fixes the defect reported in #694.

AudioPlaybackHost reported end of media while its synchronizer kept rate 1, so currentTime grew past duration for as long as the session stood. AE#374 closed the same defect on SoftwarePlaybackHost; the audio-only host never got it.

Change

  • The end-of-media callback carries the seek generation and lastEnqueuedEnd; a stale callback after a seek is dropped.
  • parkClockAtEndOfMedia defers by the audio still queued (SoftwareEndOfMediaClock.tailPlayoutSeconds, the playthrough wait releases up to 0.25 s early), then pauses the clock and publishes rate = 0. Parking at the demuxer EOF would cut that tail, as the report rightly says.
  • play() passes parkedAtEndOfMedia into RendererClockResume, so a play press after the end no longer restarts the clock as a stalled one (AE#549 path). A seek clears the latch.

The park uses pause() after the tail has played out rather than seekClock(to: lastEnqueuedEnd, rate: 0): the clock is on the last sample by then either way, and this keeps both hosts on one implementation.

Verification

  • New Issue694AudioHostEndOfMediaParkTests: a 1 s WAV through the real host. Fails on main (clock rate 1.0 after the end), passes here: rate 0, position within 10 ms over 0.5 s, at 1.0 s +- 0.1.
  • Full swift test: XCTest 17/17, swift-testing 4060 tests with one failure, SubtitleOCRTests "Vision recognizes clean synthetic subtitle text" hitting its 180 s time limit, unrelated to this change (checked against main).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS

AudioPlaybackHost reported end of media while its synchronizer kept
rate 1, so currentTime grew past duration for as long as the session
stood. AE#374 closed the same defect on the software host; this host
never got it.

The end-of-media callback now carries the generation and the last
enqueued sample end. The park defers by the audio still queued (the
playthrough wait releases up to 0.25 s early, and pausing the
synchronizer stops the renderer too), then pauses the clock and
publishes rate 0. play() treats the park like the software host does
instead of restarting it as a stalled clock, and a seek clears it.

Covered end to end by Issue694AudioHostEndOfMediaParkTests: a 1 s WAV
decoded through the real host, clock rate 0 after the end and the
position standing still within 10 ms over 0.5 s.

Reported by ijuniorfu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound
superuser404notfound merged commit 44cf223 into main Oct 4, 2026
4 checks passed
@superuser404notfound
superuser404notfound deleted the fix/694-audio-host-end-park branch October 13, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant