Repository navigation
fix(seek): await loopback-HLS landing + publish isSeeking/seekTarget (#37, #38) - #42
Merged
Merged
Conversation
…ekTarget On the native loopback-HLS path seek(to:) wrote the target clock optimistically and flipped state back to .playing without waiting for AVPlayer's seek to physically land. The 100 ms periodic time observer then kept publishing the stale pre-seek clock until the seconds-late loopback seek completed, so the reported time read the target, snapped back through the pre-seek position, then re-settled (#37). NativeAVPlayerHost.seek is now async and resolves on AVPlayer's seek completion handler; while a seek is in flight the periodic observer suppresses its stale currentTime publishing, so the clock holds the target across the landing. A seekGeneration guard lets a superseding scrub own the final state (the #35 coalescing case). seek(to:) awaits that landing before flipping back to .playing and publishes isSeeking / seekTarget, true from seek entry until the seek physically lands, uniform across programmatic seeks and native AVKit transport-bar scrubs (fired from the requestRestart coalescer, folded onto the source-PTS axis). The two in-flight sources are OR-ed so a producer restart finishing cannot drop the signal before a programmatic seek's AVPlayer landing (#38). Verified off-device via aetherctl seektest: a concurrent 20 ms sampler confirms no bounce through the pre-seek position and isSeeking spanning the landing; disabling the suppression flips the probe to FAIL, proving it detects the bug. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #37 and the programmatic + native-scrub halves of #38.
#37 — clock bounce on the native loopback-HLS seek
seek(to:)wrote the target clock optimistically and flipped state back to.playingwithout waiting for AVPlayer's seek to physically land. The 100 ms periodic time observer then kept publishing the stale pre-seek clock until the seconds-late loopback seek completed, so the reported time read the target, snapped back through the pre-seek position, then re-settled (the reporter's97012 → 29345 → 97012 → 29345trace).NativeAVPlayerHost.seekis nowasyncand resolves on AVPlayer'sseek(to:completionHandler:)callback.currentTimepublishing, so the clock holds the target across the landing.seekGenerationguard lets a superseding scrub own the final state (AVPlayer reports the abandoned seekfinished == false; this is also the Loopback-HLS playback wedges under rapid repeated seeks; recovered clock diverges from the decoded frame #35 coalescing case).seek(to:)awaits that landing before flipping back to.playing.#38 —
isSeeking/seekTargetsignalAetherEngine.isSeekingis true from seek entry until the seek physically lands (not the optimistic.playingflip), uniform across programmaticseek(to:)and native AVKit transport-bar scrubs.engine.seek()and instead drive a producer restart out of the served window, so the signal is fired from therequestRestartcoalescer and folded onto the source-PTSseekTargetaxis (additive to the Loopback-HLS playback wedges under rapid repeated seeks; recovered clock diverges from the decoded frame #35 coalescer, no change to its mechanics).stopInternalhard-clear keeps a stop landing mid-seek from stranding the signal.Verification
Off-device via
aetherctl seektest(extended with a concurrent 20 ms sampler probe):isSeekingobserved in-flight and cleared after → PASS.#37 ... YES→ FAIL, proving it detects the exact bug and the suppression is the load-bearing fix.The definitive #37 confirmation is latency-dependent (loopback / slow source / device), so a device retest is still worthwhile.
🤖 Generated with Claude Code