Repository navigation
Description
Filing the residual from the #93 retest thread, per your ask there. Traces are from 5.0.2 (d5aadc9); nothing in the 5.0.3 diff touches this mechanism. Environment as in #122: tvOS 26.5, Apple TV 4K 2021 (AppleTV11,1), loopback-HLS native path, origin = local PMS over wired gigabit LAN. Asset: 4K HEVC Dolby Vision P7 film, 7080 s, PGS subtitles on.
Summary: isolated seeks and small bursts settle fine (1-3 s typical, 8-10 s worst in a 52-seek solo storm). Under sustained queued ±10 s skip bursts — a new burst of 3-6 presses issued into an unfinished settle — the engine's reported clock adopts each new target immediately while the underlying player chases through the rebuilds. Declared state rides .playing/.buffering with rate=1.00 and waitReason=AVPlayerWaitingToMinimizeStalls / EvaluatingBufferingRate while clock and presentation diverge by the queued skip amounts (−30..+30 s). Continuous unsettled stretches measured in one heavy session: 14 s, 19 s, 19 s, 33 s. It always converges — no wedge, no A/V desync, and per the #93 retest nothing rides the read loop (zero slow-read lines; cold path exercised with 17 cache-miss backward jumps and 81 detour fills that session).
1 Hz samples (engineClock = engine currentTime, avpClock = underlying player currentTime), the 33 s episode and the deepest divergence:
14:49:56.166 engineClock=124.80 avpClock=114.88 div=-9.92 rate=1.00 wait=AVPlayerWaitingToMinimizeStallsReason
14:50:29.164 engineClock=184.80 avpClock=184.80 div=-0.00 rate=1.00 wait=AVPlayerWaitingToMinimizeStallsReason <- same episode, convergence 33s later
14:51:43.185 engineClock=53.51 avpClock=83.51 div=30.00 rate=1.00 wait=AVPlayerWaitingWhileEvaluatingBufferingRateReason
14:51:45.185 stall watchdog: state=buffering engineClock=53.515 frozenFor=3.0s avpClock=83.513 loaded=[80.2-84.1]
Buffer telemetry at the deepest chase (engine memprobe, t=150 s): avBufAhead=7.1s avBufBehind=25.4s — the player holds a wide behind-buffer while the clock sits tens of seconds away from the presented frame.
User-visible side effect — subtitle cues pace with the clock, not the picture. During a chase the cue pipeline follows the engine clock, so cues for positions 10-30 s ahead render over a still frame from the pre-seek position until convergence:
14:49:01.716 engineClock=110.30 avpClock=100.37 div=-9.94 rate=1.00 wait=AVPlayerWaitingToMinimizeStallsReason
14:49:01.762 [Subtitles] bitmap active: 1 cue(s) at t=110.300 <- cue for 110.3s over a ~100.4s frame
14:49:01.791 [applySubtitleEvent #14] cueStart=104.646s engine.currentTime=130.301s
14:49:01.882 [applySubtitleEvent #17] cueStart=122.581s engine.currentTime=130.301s <- clock already at the NEXT queued target
14:49:01.942 [applySubtitleEvent #19] cueStart=132.591s engine.currentTime=130.301s
On screen this reads as: picture frozen at the old position, dialog from somewhere else playing across it in captions, then everything snaps together at convergence.
For calibration, the heavier storms were driven in a multi-device sync session, but every seek measured here was a local user seek on this device and the divergence is single-engine behavior; the solo 52-seek storm shows the same shape, just shorter (8-10 s worst).
Reads like decode-bound rebuild compounding under queued seeks (your framing on #93), i.e. each superseded target still pays some rebuild cost before the newest one wins. Things that would visibly help, mechanism permitting: collapsing superseded targets harder so only the newest rebuild pays full cost; pacing cue application by presentation position rather than the declared clock while a seek chase is active; or a host-visible "converging" signal so hosts can hold cue rendering until presentation catches the clock.
Full session logs available on request, as always.
Activity
superuser404notfound commentedon Jul 12, 2026
Thanks, this is a clean writeup and the traces line up with a code read on this end. Confirming the mechanism split so a fix targets the right layer, and asking for one more slice of the heavy session to size the only engine-side lever before cutting anything.
Three things are folded into what you are seeing, and only one of them is an engine defect.
1. The clock jump is the intended optimistic scrub clock, not the divergence itself. On a native seek the engine publishes the target to
clock.currentTimeimmediately (issue #37: the scrubber has to snap to where you seek, before AVPlayer physically lands). The rendered-frame axis is a separate published value,clock.sourceTime, which rides AVPlayer's real rendered position and holds the on-screen frame through the seek and rebuffer (issue #49). SocurrentTimeriding ahead ofavpClockduring a chase is by design. The part worth fixing is how long the two take to reconverge, which is mechanism 3 below.2. The subtitle-over-stale-frame is a cue-pacing axis choice, and it is host side. Your
bitmap active at t=110.300selects cues againstcurrentTime(the optimistic target) while the picture is atsourceTime(~100.4). Pace cue selection againstclock.sourceTimeinstead ofclock.currentTimeand the cues stay glued to the presented frame for the whole chase, converging with the picture rather than with the target. A host that paces cues offsourceTimedoes not show this on the same asset class. That also gives you the lever-3 "converging" state for free, no new engine surface:abs(currentTime - sourceTime)is exactly the chase gap, and you can hold or gate cue rendering on it directly.3. The reconvergence time is the real engine question, and I want to size it before touching it. Your read (decode-bound rebuild compounding under queued seeks) matches the code. Producer restarts coalesce to in-flight plus one-pending (issue #35), but the in-flight restart runs to full completion before the newest pending target's restart begins, so a superseded target can still pay a full rebuild before the newest one wins. Collapsing that harder (abandoning an in-flight rebuild the moment a newer target supersedes it) is the candidate fix. It is also the exact path the coalescer was built to avoid: an abandoned producer that keeps reading the shared demuxer steals the first post-seek packet (issues #35, #79, #93), so it is not a change to make blind.
To size it, could you pull the
HLSVideoEnginesession lines from that heavy session, across one of the 30s stretches?The lines that matter:
producer restarted at idx=N ... restart took Yms; stopWait=.. reopen=.. seek=.. build=..shows how many full rebuilds actually ran across the stretch and where the time sits (build vs stopWait vs reopen).restart at idx=N coalesced behind in-flight restartandcoalesced restart advancing to settled target idx=Nshow how deep the coalescer drained.If a 30s stretch is several serial full rebuilds with the time in
build=, collapsing superseded restarts is worth the risk. If it is one or two rebuilds and the 30s is AVPlayer sitting inWaitingToMinimizeStalls/EvaluatingBufferingRatedecoding 4K DV from a keyframe out to the target, the rebuild count is not the lever and coalescing harder buys nothing. The phase split says which, and I would rather cut once. Full logs whenever you can, as offered.rrgomes commentedon Jul 12, 2026
Slice pulled — and it answers your question cleanly, plus a correction on mechanism 2 that moves a piece back to the engine side.
1. Restart phasing: your outcome B, unambiguously
All
producer restartedlines from the entire heavy phase (~20 min, ~107 seeks), not just one stretch — there are only nine:Worst restart 96 ms, time entirely in
stopWait,build=never above 1 ms. Nocoalesced behind in-flight restart/coalesced restart advancinglines at all — the coalescer never even engaged (these were single remote presses drained serially, so the engine saw each ±10 s as its own settled seek).The 33 s stretch itself (14:49:56 → 14:50:29, forward chase 124.8 → 184.8): zero producer restarts, zero
declareTargetlines. Its 1 Hz samples:rate=1.00for 31 of 33,waitReason=EvaluatingBufferingRate×23,MinimizeStalls×8,nil×2. So the long stretches contain no rebuild work at all — they are AVPlayer decoding/buffering 4K DV from keyframe out to a target that keeps moving, exactly your second branch. All nine restarts sit at backward jumps outside the long stretches and are cheap. Collapsing superseded restarts buys nothing on this trace; please don't spend the #35/#79/#93 risk on it.2. Mechanism 2 correction: we already pace cues off
sourceTime— the residual is a finalize stampWe adopted
sourceTimepacing when the #49 rework landed (our cue driver's time provider is the engine'ssourceTime, full stop). The wrong-position cues in the original report happened anyway, and the trace triangulates three clocks in the same ~100 ms:sourceTimewas not riding the rendered frame: it was parked at the previous seek's landed target — one full stride ahead of the picture, two strides behind the optimistic clock. That matches the VOD seek finalize, which stampsclock.sourceTime = landedSourcePTS(the "sourceTime + subtitle re-arm need true source PTS" line, AE#105) at landing — i.e. the #49 rendered-frame hold ends at finalize andsourceTimesnaps to the target before any frame from the landing has rendered. On an isolated seek that's a sub-second fib; under queued bursts on heavy 4K it's a sustained ~10 s lead, which is the exact offset the cues showed on screen. Notably the stalled-recovery branch just above re-anchors from the real player clock (avpReal + playlistShiftSeconds) — the honest pattern is already in the file.If finalize instead held
sourceTimeat last-rendered until the first frame from the landed position arrives (or re-anchored on frame delivery rather than at finalize), cues glued tosourceTimewould stay glued to the picture through the whole chase with no host change. It would also keepabs(currentTime - sourceTime)truthful as the "converging" gap you suggested we gate on — today that gap collapses at every landing while the picture is still seconds behind, so it under-reports exactly when it matters.Mechanism 1 is understood and fine as designed — no ask there; with
sourceTimeheld honest we get everything we need from the two published axes.Full session log available whenever you want it.
Merge fix/issue123-sourcetime-tracks-presented-frame: hold sourceTime…
chore(release): 5.0.4
superuser404notfound commentedon Jul 13, 2026
You nailed it, and thanks for the phase split. It answered both questions cleanly.
Restart coalescing is not the lever. The nine cheap restarts (worst 96 ms, all in stop-wait, build never above 1 ms) and the zero-rebuild long stretches settle it: the 14 to 33 s is AVPlayer buffering 4K DV from a keyframe out to a moving target, not serial rebuilds. Collapsing superseded restarts would have bought nothing and spent the #35/#79/#93 risk for it, so that stays untouched. Exactly the outcome-B you called.
You were right that this is engine-side, and the earlier "host cue-pacing" framing was wrong. Your triangulation is the whole story:
sourceTimewas not riding the rendered frame, it was parked on the previous seek's landed target. The VOD seek finalize stampedclock.sourceTime = landedSourcePTS, and the native host's seek completion stampedrenderedTime = avPlayer.currentTime(), both onto the target unconditionally at landing. During a queued-burst chase the player sits inwaitingToPlayAtSpecifiedRatewith the picture frozen behind the target, and the 100 ms periodic observer that would walk the clock back to the rendered frame is silent while buffering (the timebase is not advancing), so the target stamp stuck for the whole chase. A host pacing cues offsourceTime, the axis built for exactly that, then drew them over the stale frame. That is asourceTimecontract break (#49), not a host bug.Fix (5.0.4). Both stamps are now gated on whether the landed frame is actually presented. A playing or paused landing shows the target frame and settles immediately, so isolated scrubs and paused scrubs (#122) are unchanged. A landing still buffering toward the target holds
sourceTimeon the rendered frame; the$renderedTimesink settles it onto the target when playback resumes and the frame is delivered. SosourceTimetracks the picture through the chase, and as you pointed out,abs(currentTime - sourceTime)now stays truthful as the converging gap instead of collapsing at every landing while the picture is still behind.The one thing that does not reproduce on a fast LAN is the sustained chase itself, so this is the piece to watch on your rig: with cues paced off
sourceTime, do they stay glued to the picture through a heavy queued burst (no 10 to 30 s lead), and doessourceTimeconverge onto the target as playback resumes rather than snapping ahead at each landing. If a cue still leads the frame, loggingtimeControlStatusat the landing instant next tosourceTimeis the next thread to pull.5.0.4: https://github.com/superuser404notfound/AetherEngine/releases/tag/5.0.4
Full session log still welcome if the retest turns anything up.
rrgomes commentedon Jul 13, 2026
Retested on 5.0.4 with the same asset class and a heavier mixed-direction storm: the fix holds. Cues paced off
sourceTimestayed glued to the presented frame through the whole queued chase — during the catch-up phases the cue clock rode the picture (e.g. cues rendering at t≈22 s while the optimistic clock was already at 62–97 s) with none of the 10–30 s leads from the original report, andsourceTimeconverged onto targets as playback resumed rather than snapping at landings. ThetimeControlStatus-at-landing thread you flagged never needed pulling.One new find from the same retest session, filed separately since it's a different mechanism entirely: subtitle cues can permanently starve after a backward seek into segment-cache-resident content (the packet store prunes 300 s behind the playhead and only the producer's pump can refill it) — #125. It surfaced because this retest storm was long enough to push the prune cutoff past the return region; nothing about it changes the #123 verdict.
superuser404notfound commentedon Jul 14, 2026
Confirmed closed on your 5.0.4 verify, and thanks for the clean retest.
The
sourceTimehold does exactly what it needed to: cues paced offsourceTimestay glued to the presented frame through the whole queued chase, no 10 to 30 s lead, andsourceTimeconverges onto the target as playback resumes rather than snapping ahead at each landing. ThetimeControlStatus-at-landing thread never needed pulling.Closing as fixed in 5.0.4.
The packet-store starvation you filed from the same session (#125) is a separate mechanism, tracked on its own, and nothing there changes this verdict. Picking it up next.
fix(seek): hold clock at target on recovery fallthrough (no revert + …
fix(transport): hold sourceTime on the rendered frame during a buffer…
feat(transport): LoadOptions.autoplay for an honest paused mount (sup…
fix(seek): recover slow-source VOD seeks without reverting the clock
fix(seek): recover slow-source VOD seeks without reverting the clock
fix(seek): recover slow-source VOD seeks without reverting the clock
fix(native): recovery paths must not read AVPlayer on the main actor (s…
feat(subtitles): the native item states every landing