You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Presented frame drifts ~6 s ahead of currentTime/sourceTime after a rapid bidirectional seek burst (loopback-HLS native path) — frameAhead/producerShift/hostShift all report 0 #65
Filing as the Watch Together consumer that just adopted isSeeking/seekTarget (#42/#38 — working well for us, thanks). Seen on 3.13.4, tvOS 26, native loopback-HLS direct play (H.264 title with a PGS subtitle track).
Symptom. After a rapid bidirectional seek/scrub burst, the engine settles into a state where the frame on screen is ~6 s ahead, in source content, of what currentTime and clock.sourceTime report — and it stays there (persists through a pause; does not reconcile). Hosts read currentTime for the scrubber and sourceTime for the subtitle clock, so the timeline and subtitles both trail the picture by ~6 s.
Frame-exact verified: with playback paused, opening the same file in IINA and stepping to the exact frame on screen read ~6 s later than the engine's reported position (not an eyeball estimate).
The engine's coherence metrics did not reflect it. At that moment, reading the public accessors:
currentTime ≈ avpClock, and frameAhead = producerShift − hostShift = 0 — so the engine believed it was fully coherent while the presented content was ~6 s further along. (avBufAhead was ~6.5 s per the memprobe — suggestive, but I won't over-read it.)
Trigger / repro. Hit via a two-peer "dueling scrub" — both peers scrubbing opposite directions, ~10 seek(to:) on one engine within a few seconds. The seek pattern (rapid alternating-direction seeks on the loopback-HLS native path) should reproduce solo — like the #49 seektest harness but alternating direction rather than monotonic. Looks like a sibling of #49 (closed) where the divergence lands between the presented source content and currentTime, with the shift accounting reading 0.
Hypothesis (low confidence — you know the internals): the producer's source-PTS → playlist-time mapping drifts by ~6 s under the alternating-direction burst, but the shift used to derive currentTime/sourceTime settles back to 0 without capturing the offset — so AVPlayer faithfully presents the playlist position whose bytes are ~6 s of source ahead of the reported clock.
Happy to help: I can capture an on-device trace pairing avpClock/currentTime/frameAhead against an IINA-frame-matched ground truth, and run any specific seek pattern you'd like.
Thanks for the precise report, and the frame-exact IINA cross-check is exactly what makes this actionable.
Traced it to the loopback-HLS shift fold. Where I have landed:
Live defers a producer shift change by appending a (seamOutputSeconds, newShift) seam to a history, then folds currentTime/sourceTime with "newest seam at or before the raw AVPlayer clock", so bytes buffered under the old shift keep folding with the old shift until the playhead crosses the seam.
The VOD scrub path has no such history. Every producer restart routes through onPlaylistShiftChanged, which collapses the seam history to a single (-inf, newShift) baseline, so the fold degenerates to the latest scalar shift. The seam-append path is gated if isLive in the producer, so VOD never records one.
A VOD seek does not flush AVPlayer's buffer (bare seek(to:), no replaceCurrentItem), and loopback segment URLs are index-stable with a byte-deterministic init.mp4. So after a bidirectional burst, AVPlayer can keep presenting buffered bytes that a superseded producer epoch muxed under a different shift, while the fold uses the latest scalar. That matches your trace: picture ~6 s ahead, with frameAhead/producerShift/hostShift all 0 (they only compare the settled producer shift against the host scalar, which are equal by construction, with no per-buffered-segment memory), and avBufAhead roughly equal to the shift delta.
Two candidate roots produce that same avBufAhead == offset signature, and I cannot separate them from source alone because they need different fixes:
Root A: the per-restart producer shift actually VARIES across the burst (a seek lands off the planned keyframe, or the uniform-fallback segment plan kicks in), so the buffered old-epoch bytes fold with the wrong shift. Fix: port the live seam-history to shift-changing VOD restarts.
Root B: the per-restart shift is invariant and the ~6 s comes from the loopback playlist startSeconds disagreeing with the restarted segment's tfdt. A seam port would not address this; it needs a buffer flush or segment URL re-key on a shift-changing restart.
To tell them apart I pushed instrumentation in ee0238c. If you can pin to that (or newer) and capture one dueling-scrub burst with engine logging on, two log families settle it:
[AetherEngine] #65 VOD shift published: <s>s (prev <s>s, delta <s>s, changed=YES/no) ... avBufAhead=<s>s, alongside the producer's existing [HLSSegmentProducer] video gate open: ... shift=<ticks>. Two distinct shift values across the burst means Root A; an invariant shift means Root B.
The 30 s memprobe line now also carries frameAhead= prodShift= hostShift= seams= avBufAhead=. At the divergent moment I expect seams=1 (the degenerate VOD history) with a multi-second avBufAhead while the three shift numbers read 0.
If a headless macOS repro is easier on your side, aetherctl seektest <file> --seeks 40 --gap-ms 60 now runs the alternating burst and prints a Root A / Root B / inconclusive verdict from those same logs. It flags short, fully-produced files as inconclusive, since the cascade only fires when a seek lands beyond the producer write head, so it wants a longer title.
Once we know which root, the fix is straightforward. Thanks again.
Captured on 4.0.2, tvOS 26. Source: a ~2h 4K HEVC title, ~52 Mbps, TrueHD audio (so it bridges through the engine and plays via the loopback-HLS path), direct-played. Solo alternating forward/back scrub burst (~12 seeks). Verdict: Root B (invariant shift).
#65 VOD shift published — always 0, never changes across the burst:
Every [HLSSegmentProducer] video gate open in the burst is shift=0 too. The memprobe at the divergent moment is the Root B signature you predicted — seams=1, a multi-second avBufAhead, and all three shift numbers reading 0:
So it's the invariant-shift / playlist-startSeconds-vs-restarted-tfdt case, not a varying per-restart shift — the seam-history port wouldn't address it.
One extra data point: on this feature-length, high-bitrate title the divergence cascaded into a full producer stall. After the burst, memprobe pktTotal / avioFetchedMB / muxBytesMB froze identical and avBufAhead stuck at ~1.6 s, playback frozen on screen:
Possibly the #50-family loopback wedge rather than #65 proper, but flagging it since on a long high-bitrate title the burst stalls the producer outright rather than just offsetting the clock. Happy to capture more, or run a specific seek pattern.
Thanks for the 4.0.2 capture, and especially for the frozen-producer data point. That recapture made me re-check my own instrumentation, and I owe you a correction: the "Root B (invariant shift)" readout was weaker than I implied. The avBufAhead=6.5s is just normal forward buffer, and frameAhead/prodShift/hostShift=0 is true by construction whenever the shift is invariant, so those three numbers cannot actually see a presented-vs-clock gap. Your frame-exact IINA check is solid; the problem is the engine had no signal that could corroborate it either way. So I built one.
b08ab0a (please pin to it or any newer main) adds two positive probes, both on category: .session:
Per-segment ledger at the VOD routing site: [HLSSegmentProducer] #65 ledger seg-N base=B itemAxis=X sourceStart=Y planSource=Z drift=D shift=S
This maps each segment's item-axis position (what currentTime reports) to the actual source content muxed into it. drift = sourceStart - planSource. A multi-second drift on the segment your playhead sits in is a positive confirmation that the picture leads the clock, with the exact seg/epoch. drift ~0 across the whole burst means there is no content-vs-clock offset, and the 6 s is something else (see HDR10+ and Dolby Vision missing dynamic metadata #2).
VOD backpressure wedge probe, wrapping the producer's two backpressure gates: [HLSSegmentProducer] #65 backpressure PARK (alloc|advance) head= target= cacheTarget= highStored= cached= parked=Ns
This only fires on an abnormal park (no playback progress for > ~2 segment durations), so healthy backpressure stays quiet. A frozencacheTarget below target is the producer wedge that matches your 90 s pktTotal freeze; a climbingcacheTarget is just normal buffering. Every VOD pump watchdog is currently live-only, which is why nothing breaks this on VOD.
Could you reproduce one dueling-scrub burst on the same ~2 h title, engine logging on, and paste:
the #65 ledger lines around the divergent moment (and the currentTime you read there, so I can match it to a seg),
the one-time [HLSVideoEngine] segment plan: ... line (keyframe-aligned vs uniform fallback),
any #65 backpressure PARK lines during the freeze.
That trace is dispositive: drift > 0 on a segment points the fix at the content-drift source; drift ~0 plus PARK lines points it at the VOD wedge. Either way I stop guessing. Thanks again for the rigor.
The divergence is engineClock vs the AVPlayer clock — a snap-to-seek-target: in every FreezeDiag engineClock == lastSeekTarget while AVPlayer's clock lags 30–40s, stuck buffering with empty/tiny loaded ranges:
Gaps are ~integer multiples of the 10s seek step — the engine clock advances one step per rapid seek while AVPlayer lands only the first. frameAhead/producerShift/hostShift=0 throughout.
Then it deadlocks with no recovery:backpressure PARK head=64 target=54 cacheTarget=53 cached=20, escalating parked=12s→62s+. The wedge is also severe enough to starve our UDP log sender on a longer burst.
Net: producer is clean; the engine resolves clock+state to the seek target before AVPlayer lands it (a sustained-burst form of #37), AVPlayer never catches up, and the producer parks permanently with no VOD watchdog. Happy to add an AVPlayer timeControlStatus/seek-completion trace if useful.
Your 4.1.0 trace nailed it: the producer ledger was clean (drift=0 throughout), so this was never a content/shift drift but a two-half livelock on the loopback path. A sustained burst left the engine clock latched at an optimistic seek target AVPlayer never reached, while the segment producer parked on backpressure with no VOD watchdog, and the two waited on each other with no recovery floor.
4.2.2 gives both halves a recovery floor:
The native VOD seek await is now bounded by a cadence budget. When a seek does not land and AVPlayer is genuinely starved (no forward buffer), the engine reconciles its clock to AVPlayer's real rendered position instead of the unreachable target and re-anchors the producer there. A slow-but-buffering seek still awaits its real landing exactly as before.
The VOD backpressure park gains the watchdog the live paths always had: a consumer fetch target frozen past a threshold breaks the park and re-anchors the producer on AVPlayer's real position (a slow-but-advancing consumer never trips it, and a storm guard bounds re-anchors if AVPlayer never resumes).
If you can retest on a long high-bitrate title: aetherctl seektest <file> --seeks 40 --gap-ms 60 now prints the wedge-break / re-anchor / reconcile recovery signals, and AetherPlayer is pinned to 4.2.2 for an interactive repro. Thanks again for the frame-exact diagnosis.
The 4.2.2 #65 fix resolves the scrub-burst case, but its backpressure wedge-breaker has a false-positive: a deliberate user pause is misread as a wedge. Captured on 4.5.1, tvOS 26. Source: a ~2.1 h 4K HEVC direct-play with TrueHD audio (so it bridges to the loopback-HLS native path), 3× PGS subtitle tracks.
Repro: play the loopback-HLS native title, pause for >~24 s, then resume.
What happens (device-mirrored EngineLog):
Pause → [NativeAVPlayerHost] timeControlStatus=paused rate=0.0. The producer correctly stops being consumed.
~24 s later the backpressure detector trips — on the pause, not a wedge:
[HLSSegmentProducer] #65 backpressure PARK (advance) head=128 target=118 cacheTarget=117 … parked=22s (no playback progress)
[HLSSegmentProducer] #65 backpressure WEDGE BROKEN (advance) … parked=24s; exiting pump for host re-anchor on AVPlayer position
[HLSVideoEngine] #65 backpressure wedge: re-anchoring producer to AVPlayer position 456.47s -> seg114 (attempt 1/5)
The player is still paused, so the consumer never advances → re-anchor 2/5…5/5 over ~3.5 min, then:
[HLSVideoEngine] #65 backpressure wedge re-anchor cap reached (6 consecutive at pos=456.47s); giving up (AVPlayer not resuming).
On resume, AVPlayer can't recover — its loaded buffer is stranded behind the playhead and never refills:
loaded=[264.3-338.1] vs avpClock=463.917 — the buffer sits ~125–200 s behind the playhead and never advances; pause/resume is inert. Permanent wedge (force-quit required).
Root cause:BackpressureWedgeDetector (Piece A) treats a frozen consumer fetch target as a wedge, but a paused AVPlayer legitimately freezes it — it issues no forward fetch by design. With no pause-awareness the detector fires during the pause, and the re-anchor loop runs against a player that can't advance because it's paused, burning all 6 attempts and leaving the producer re-anchored at 456 s while AVPlayer's buffer is stranded at 264–338 s, a state resume can't recover.
Suggested fix: suspend the backpressure wedge detector (and its park timer) whenever rate == 0 / timeControlStatus == .paused; only run wedge detection when playback is actually requested. A paused consumer must never trip it. The seek-deadline starvation path (Piece B) likely wants the same pause-guard.
For real-world use this bites harder than the original #65 (which needed a sustained dueling-scrub) — it fires on an ordinary >24 s pause of bridged-audio content. We've pinned back to 4.2.1 locally meanwhile. Happy to capture a fresh-logger onset trace or the resume sequence if useful.
Activity
diag(player): instrument #65 seek-burst frame drift (VOD shift-publis…
superuser404notfound commentedon Jun 24, 2026
Thanks for the precise report, and the frame-exact IINA cross-check is exactly what makes this actionable.
Traced it to the loopback-HLS shift fold. Where I have landed:
(seamOutputSeconds, newShift)seam to a history, then foldscurrentTime/sourceTimewith "newest seam at or before the raw AVPlayer clock", so bytes buffered under the old shift keep folding with the old shift until the playhead crosses the seam.onPlaylistShiftChanged, which collapses the seam history to a single(-inf, newShift)baseline, so the fold degenerates to the latest scalar shift. The seam-append path is gatedif isLivein the producer, so VOD never records one.seek(to:), noreplaceCurrentItem), and loopback segment URLs are index-stable with a byte-deterministic init.mp4. So after a bidirectional burst, AVPlayer can keep presenting buffered bytes that a superseded producer epoch muxed under a different shift, while the fold uses the latest scalar. That matches your trace: picture ~6 s ahead, withframeAhead/producerShift/hostShiftall 0 (they only compare the settled producer shift against the host scalar, which are equal by construction, with no per-buffered-segment memory), andavBufAheadroughly equal to the shift delta.Two candidate roots produce that same
avBufAhead == offsetsignature, and I cannot separate them from source alone because they need different fixes:startSecondsdisagreeing with the restarted segment'stfdt. A seam port would not address this; it needs a buffer flush or segment URL re-key on a shift-changing restart.To tell them apart I pushed instrumentation in
ee0238c. If you can pin to that (or newer) and capture one dueling-scrub burst with engine logging on, two log families settle it:[AetherEngine] #65 VOD shift published: <s>s (prev <s>s, delta <s>s, changed=YES/no) ... avBufAhead=<s>s, alongside the producer's existing[HLSSegmentProducer] video gate open: ... shift=<ticks>. Two distinct shift values across the burst means Root A; an invariant shift means Root B.memprobeline now also carriesframeAhead= prodShift= hostShift= seams= avBufAhead=. At the divergent moment I expectseams=1(the degenerate VOD history) with a multi-secondavBufAheadwhile the three shift numbers read 0.If a headless macOS repro is easier on your side,
aetherctl seektest <file> --seeks 40 --gap-ms 60now runs the alternating burst and prints a Root A / Root B / inconclusive verdict from those same logs. It flags short, fully-produced files as inconclusive, since the cascade only fires when a seek lands beyond the producer write head, so it wants a longer title.Once we know which root, the fix is straightforward. Thanks again.
rrgomes commentedon Jun 25, 2026
Captured on 4.0.2, tvOS 26. Source: a ~2h 4K HEVC title, ~52 Mbps, TrueHD audio (so it bridges through the engine and plays via the loopback-HLS path), direct-played. Solo alternating forward/back scrub burst (~12 seeks). Verdict: Root B (invariant shift).
#65 VOD shift published— always 0, never changes across the burst:Every
[HLSSegmentProducer] video gate openin the burst isshift=0too. The memprobe at the divergent moment is the Root B signature you predicted —seams=1, a multi-secondavBufAhead, and all three shift numbers reading 0:So it's the invariant-shift / playlist-
startSeconds-vs-restarted-tfdtcase, not a varying per-restart shift — the seam-history port wouldn't address it.One extra data point: on this feature-length, high-bitrate title the divergence cascaded into a full producer stall. After the burst, memprobe
pktTotal/avioFetchedMB/muxBytesMBfroze identical andavBufAheadstuck at ~1.6 s, playback frozen on screen:Possibly the #50-family loopback wedge rather than #65 proper, but flagging it since on a long high-bitrate title the burst stalls the producer outright rather than just offsetting the clock. Happy to capture more, or run a specific seek pattern.
diag(player): instrument #65 with a positive content-vs-clock ledger …
superuser404notfound commentedon Jun 25, 2026
Thanks for the 4.0.2 capture, and especially for the frozen-producer data point. That recapture made me re-check my own instrumentation, and I owe you a correction: the "Root B (invariant shift)" readout was weaker than I implied. The
avBufAhead=6.5sis just normal forward buffer, andframeAhead/prodShift/hostShift=0is true by construction whenever the shift is invariant, so those three numbers cannot actually see a presented-vs-clock gap. Your frame-exact IINA check is solid; the problem is the engine had no signal that could corroborate it either way. So I built one.b08ab0a(please pin to it or any newermain) adds two positive probes, both oncategory: .session:Per-segment ledger at the VOD routing site:
[HLSSegmentProducer] #65 ledger seg-N base=B itemAxis=X sourceStart=Y planSource=Z drift=D shift=SThis maps each segment's item-axis position (what
currentTimereports) to the actual source content muxed into it.drift = sourceStart - planSource. A multi-seconddrifton the segment your playhead sits in is a positive confirmation that the picture leads the clock, with the exact seg/epoch.drift ~0across the whole burst means there is no content-vs-clock offset, and the 6 s is something else (see HDR10+ and Dolby Vision missing dynamic metadata #2).VOD backpressure wedge probe, wrapping the producer's two backpressure gates:
[HLSSegmentProducer] #65 backpressure PARK (alloc|advance) head= target= cacheTarget= highStored= cached= parked=NsThis only fires on an abnormal park (no playback progress for > ~2 segment durations), so healthy backpressure stays quiet. A frozen
cacheTargetbelowtargetis the producer wedge that matches your 90 spktTotalfreeze; a climbingcacheTargetis just normal buffering. Every VOD pump watchdog is currently live-only, which is why nothing breaks this on VOD.Could you reproduce one dueling-scrub burst on the same ~2 h title, engine logging on, and paste:
#65 ledgerlines around the divergent moment (and thecurrentTimeyou read there, so I can match it to aseg),[HLSVideoEngine] segment plan: ...line (keyframe-aligned vs uniform fallback),#65 backpressure PARKlines during the freeze.That trace is dispositive:
drift > 0on a segment points the fix at the content-drift source;drift ~0plusPARKlines points it at the VOD wedge. Either way I stop guessing. Thanks again for the rigor.chore(release): 4.0.3
rrgomes commentedon Jun 26, 2026
4.1.0 (
931f0a3), reproduced cleanly. tvOS, loopback-HLS native path; a 2.1h 4K HEVC + TrueHD title. Rapid bidirectional scrub burst (~20 relative seeks / ~19s).The ledger exonerates the producer — every segment through the burst is exact:
The divergence is engineClock vs the AVPlayer clock — a snap-to-seek-target: in every FreezeDiag
engineClock == lastSeekTargetwhile AVPlayer's clock lags 30–40s, stuck buffering with empty/tiny loaded ranges:Gaps are ~integer multiples of the 10s seek step — the engine clock advances one step per rapid seek while AVPlayer lands only the first.
frameAhead/producerShift/hostShift=0throughout.Then it deadlocks with no recovery:
backpressure PARK head=64 target=54 cacheTarget=53 cached=20, escalatingparked=12s→62s+. The wedge is also severe enough to starve our UDP log sender on a longer burst.Net: producer is clean; the engine resolves clock+state to the seek target before AVPlayer lands it (a sustained-burst form of #37), AVPlayer never catches up, and the producer parks permanently with no VOD watchdog. Happy to add an AVPlayer timeControlStatus/seek-completion trace if useful.
chore(release): prep 4.2.2 — loopback-HLS VOD scrub-burst livelock fix (
superuser404notfound commentedon Jun 26, 2026
Fix shipped in 4.2.2.
Your 4.1.0 trace nailed it: the producer ledger was clean (
drift=0throughout), so this was never a content/shift drift but a two-half livelock on the loopback path. A sustained burst left the engine clock latched at an optimistic seek target AVPlayer never reached, while the segment producer parked on backpressure with no VOD watchdog, and the two waited on each other with no recovery floor.4.2.2 gives both halves a recovery floor:
If you can retest on a long high-bitrate title:
aetherctl seektest <file> --seeks 40 --gap-ms 60now prints the wedge-break / re-anchor / reconcile recovery signals, and AetherPlayer is pinned to 4.2.2 for an interactive repro. Thanks again for the frame-exact diagnosis.fix(video): break the loopback-HLS VOD scrub-burst livelock (superuse…
rrgomes commentedon Jun 26, 2026
The 4.2.2 #65 fix resolves the scrub-burst case, but its backpressure wedge-breaker has a false-positive: a deliberate user pause is misread as a wedge. Captured on 4.5.1, tvOS 26. Source: a ~2.1 h 4K HEVC direct-play with TrueHD audio (so it bridges to the loopback-HLS native path), 3× PGS subtitle tracks.
Repro: play the loopback-HLS native title, pause for >~24 s, then resume.
What happens (device-mirrored EngineLog):
[NativeAVPlayerHost] timeControlStatus=paused rate=0.0. The producer correctly stops being consumed.loaded=[264.3-338.1]vsavpClock=463.917— the buffer sits ~125–200 s behind the playhead and never advances; pause/resume is inert. Permanent wedge (force-quit required).Root cause:
BackpressureWedgeDetector(Piece A) treats a frozen consumer fetch target as a wedge, but a paused AVPlayer legitimately freezes it — it issues no forward fetch by design. With no pause-awareness the detector fires during the pause, and the re-anchor loop runs against a player that can't advance because it's paused, burning all 6 attempts and leaving the producer re-anchored at 456 s while AVPlayer's buffer is stranded at 264–338 s, a state resume can't recover.Suggested fix: suspend the backpressure wedge detector (and its park timer) whenever
rate == 0/timeControlStatus == .paused; only run wedge detection when playback is actually requested. A paused consumer must never trip it. The seek-deadline starvation path (Piece B) likely wants the same pause-guard.For real-world use this bites harder than the original #65 (which needed a sustained dueling-scrub) — it fires on an ordinary >24 s pause of bridged-audio content. We've pinned back to 4.2.1 locally meanwhile. Happy to capture a fresh-logger onset trace or the resume sequence if useful.
fix(producer): suspend #65 VOD backpressure wedge detector while paused
chore(release): prep 4.5.2 — suspend #65 VOD wedge detector while paused
23 remaining items
fix(live): size the live window by what the session can hold
fix(live): let an in-place recovery keep the place it held
fix(engine): a session-preserving reload preserves the transport and …
fix(native): the media fallback comes back where the refused item was…
test(aetherctl): drill the stage-2 reload against a paused and a resu…
fix(engine): a software rebuild superseded by stop() or a new load() …
fix(session): a quiet consumer that is still rendering is not a backp…
fix(native): the media fallback comes back where the refused item was…
feat(native): serve VOD loopback segments while they are written
feat(native): serve VOD loopback segments while they are written
feat(subtitles): a host can let AVKit's own subtitle menu pick the na…
feat(subtitles): a host can let AVKit's own subtitle menu pick the na…
feat(airplay): request the native rendition for a wireless receiver t…
Keep segment files within the disk budget on nearly full volumes; nam…
fix(io): resident run park review findings (AE#1109)