Skip to content

fix(seek): await loopback-HLS landing + publish isSeeking/seekTarget (#37, #38) - #42

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/seek-landing-signal-37-38
Jun 16, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/seek-landing-signal-37-38

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

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 .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 (the reporter's 97012 → 29345 → 97012 → 29345 trace).

  • NativeAVPlayerHost.seek is now async and resolves on AVPlayer's seek(to:completionHandler:) callback.
  • 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 (AVPlayer reports the abandoned seek finished == 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 / seekTarget signal

  • AetherEngine.isSeeking is true from seek entry until the seek physically lands (not the optimistic .playing flip), uniform across programmatic seek(to:) and native AVKit transport-bar scrubs.
  • Native scrubs bypass engine.seek() and instead drive a producer restart out of the served window, so the signal is fired from the requestRestart coalescer and folded onto the source-PTS seekTarget axis (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).
  • The programmatic and native in-flight sources are OR-ed, so a producer restart finishing cannot drop the signal before a programmatic seek's AVPlayer landing, and vice versa.
  • A stopInternal hard-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):

  • Fix active: no bounce through the pre-seek position, isSeeking observed in-flight and cleared after → PASS.
  • Suppression disabled (teeth-test): the probe flips to #37 ... YES → FAIL, proving it detects the exact bug and the suppression is the load-bearing fix.
  • Full test suite: 125 tests, 0 failures.

The definitive #37 confirmation is latency-dependent (loopback / slow source / device), so a device retest is still worthwhile.

🤖 Generated with Claude Code

…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]>
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.

Seek on the loopback-HLS native path resolves clock + state before the seek lands → reported time bounces back through the pre-seek position

1 participant