Repository navigation
Description
On an Apple TV, when a running session is switched from the native path to the software path in place (preferredDecodePath = .software), a title with no audio track starts its clock about 0.93 s before the first frame is enqueued, and the renderer drops 5 to 7 frames within about a second of that frame. Three runs on each of 7.35.1 and 7.36.0 read the same.
Setup. Apple TV 4K (3rd generation, AppleTV14,1), tvOS 26.6, Debug builds of our app, both engines in one sitting on 15 October, each run in a fresh process. The title is a 110 s Dolby Vision profile 8.1 test clip (HEVC 3840x2014, 10-bit, 23.976 fps, 11 keyframes, no audio track, so the engine logs audio delivery = noAudioInSource), played direct from Jellyfin and resumed at 30 s on the native path through our loopback route. Our app switches a session to the software path when the native path has shown no picture for 60 s. In these runs we forced that switch with a test hook of ours that hides the first frame from the app's check, so the title was playing natively when the switch came. The engine logs #460: reload applying preferredDecodePath and #461: host asked for the software path, overriding the native route, and the software session opens at the current position, about 86.4 to 86.6 s.
What we see. Positions are seconds of media; the gap is wall time between the two lines' timestamps.
| engine | run | clock start, [AudioOutput] seekClock to= |
first frame, [SWHost] first video frame enqueued: … pts= |
clock start to first frame | layerDrop at the [SWDiag] tick about 1 s after the first frame |
dropped in the run, stats final |
|---|---|---|---|---|---|---|
| 7.35.1 | 1 | 86.400 | 86.420 s | 0.899 s | 5 | 5 |
| 7.35.1 | 2 | 86.600 | 86.628 s | 0.940 s | 7 | 7 |
| 7.35.1 | 3 | 86.600 | 86.628 s | 0.949 s | 6 | 6 |
| 7.36.0 | 1 | 86.600 | 86.628 s | 0.935 s | 5 | 5 |
| 7.36.0 | 2 | 86.601 | 86.628 s | 0.929 s | 5 | 5 |
| 7.36.0 | 3 | 86.400 | 86.420 s | 0.905 s | 5 | 5 |
The drops appear on the tick 0.99 to 1.08 s after the first frame; on five runs an earlier tick, 0.03 to 0.08 s after it, still reads layerDrop=0(+0), as in the lines below. No later tick adds one, and every run reports 0 stalls. No clock re-anchored line follows the switch on any run. 7.36.0, run 1, the lines from the clock start (date and level prefix cut, nothing else changed):
20:40:58.587 [AudioOutput] seekClock to=86.600 rate=1.0
20:40:58.768 [SWReadAhead] producer qos -> utility (now=utility reservoir=20.1s relax=20.0s boost=10.0s waiting=0)
20:40:59.512 [SWDecoder] output 10-bit P010, video range (frame yuv420p10le, color_range=1)
20:40:59.522 [SWHost] first video frame enqueued: pixfmt=0x78343230 size=3840x2014 pts=86.628s
20:40:59.527 [SWHost] picture settles at 3840x2014 after 1 frames
20:40:59.531 [Renderer] enqueue #1: status=rendering ready=true error=nil
20:40:59.531 [SWHost] layer.isReadyForDisplay=true after 2 frames
20:40:59.532 [AetherEngine] #361 startup 8/8 presenting (gen 2)
20:40:59.564 [SWDiag] clk=87.57 dclk=- rate=1.00 aLead=- aRend=unknown/n/- vLead=-0.78 parkedPkts=0 rebuf=n enq=+5 disp=+4 lost=0(+0) dpts=41.7/41.7 layerDrop=0(+0) delay=0.00(+0.00) corrupt=0 status=rendering surf=1920x1080 r4d=y
20:40:59.858 [Renderer] enqueue #30: status=rendering ready=true error=nil
20:41:00.564 [SWDiag] clk=88.57 dclk=1.00 rate=1.00 aLead=- aRend=unknown/n/- vLead=-0.15 parkedPkts=0 rebuf=n enq=+51 disp=+51 lost=0(+0) dpts=41.7/41.7 layerDrop=5(+5) delay=0.00(+0.00) corrupt=0 status=rendering surf=1920x1080 r4d=y
20:41:01.564 [SWDiag] clk=89.57 dclk=1.00 rate=1.00 aLead=- aRend=unknown/n/- vLead=0.35 parkedPkts=0 rebuf=n enq=+24 disp=+24 lost=0(+0) dpts=41.7/41.7 layerDrop=5(+0) delay=0.00(+0.00) corrupt=0 status=rendering surf=1920x1080 r4d=y
Earlier runs of the same steps, for context. At 7.1.3 and 7.7.1 they read 0 frames dropped (our comment on #461, 21 September). Single runs on 13 October, in the table's columns:
| engine | clock start, seekClock to= |
first frame pts= |
clock start to first frame | layerDrop about 1 s after the first frame |
dropped in the run |
|---|---|---|---|---|---|
| 7.28.3 | 83.417, then [SWHost] clock re-anchored to first sample: anchor=83.417s (load anchor 86.700s, sessionZero=0.000s) |
86.712 s | 0.979 s | 0 | 0 |
| 7.35.1 | 86.601 | 86.628 s | 0.927 s | 5 | 5 |
At 7.28.3, before 7.32.2's anchor change for #724, the gap was about the same, but the clock started 3.3 s behind the first frame: the tick right after that frame read clk=84.39 and vLead=2.32. On the six later runs whose tick came within 0.08 s of the first frame (7.35.1 on 13 October and five of the six above), it read vLead -0.66 to -0.82. One run of a 1080p H.264 title with an audio track through the same switch at 7.35.1 read 0.298 s and 3 frames dropped; we have not repeated that one.
7.37.0 came out after these runs, and we have not run it. Its video preroll (#774) holds the clock until frames are queued; the comment on it names "five dropped frames at every start and every seek on an Apple TV 4K (A12)" on the Profile 7 FEL route (AudioOutput.swift:414-416), and the software host applies it to that route only: "every other route answers nil and starts at once" (SoftwarePlaybackHost.swift:1222-1224; both files at 7.37.0). This title is profile 8.1, a single layer. 7.37.0 also keeps the tvOS software packet cache in memory (#776).
What we expected. The first frames after the switch shown at their times, without drops.
We have no screen recording of these runs, so we cannot say how the drops look on the TV.
7.35.1 is our app's engine pin as of today (2026-10-16); 7.36.0 is the candidate, measured beside it.
Activity
superuser404notfound commentedon Oct 16, 2026
Thanks for the careful measurements, the 7.28.3 comparison was what pinned it down.
Cause. The software host started its clock when the first packet went into the decoder (a title with no audio) or when the first audio buffer decoded (a title with audio). At that moment the video decoder was still working from the keyframe before the target up to the target. On a 10 s GOP that is about 3 s of 4K HEVC to decode, which matches the ~0.93 s you measured. The first frames then reached the layer late and were dropped. Before 7.32.2 the #724 re-anchor started the clock a whole GOP behind, on the keyframe, and that hid the gap. Once the anchor stayed on the target, the gap became visible. Your 1080p H.264 run with audio (0.298 s, 3 dropped) is the same thing, armed by audio instead.
Fix. 713c62a on main, not released yet. The video preroll that #774 added for the FEL route now covers every software VOD route. The clock waits at rate 0 until frames from its position on (0.125 s worth) are in the layer, then starts 250 ms from that moment. The same applies to starts, seeks and the in-place switch. Live streams off the FEL route still start at once, so the live join is unchanged.
On the Mac, with a 4K HEVC 10-bit fixture with no audio and 10 s GOPs, through the same in-place native to software switch:
That shows the clock now waits for the picture. It does not show the drop count: the CLI has no render surface, so
layerDropclimbs in every run there and means nothing. Whether the 5 to 7 drops are gone on the Apple TV still needs a device run. The[AudioOutput] preroll ready after N msline is the one to look for. Atimed outin its place would mean the gate never opened, and that run is worth sending.I'll leave this open until it has been measured on the device.
superuser404notfound commentedon Oct 16, 2026
Released in 7.38.0 (713c62a). Sodalite and AetherPlayer already pin it.
fix(sw): hold the clock until the first frames are queued on every VO…
Merge tag '7.38.1' into fix/matroska-h264-frame-cadence
cmcpherson274 commentedon Oct 22, 2026
A correction to the issue text: 7.37.0 was published at 21:37 UTC on 15 October, about 2 h 49 min before the first of these runs (00:26 UTC on 16 October); we ran 7.35.1 and 7.36.0 only.
Here is the device reading you asked for. We ran 7.44.0, which carries 7.38.0's preroll gate unchanged (
AudioOutput.swiftandSampleBufferRenderer.swiftare the same files at 7.38.0 and 7.44.0), beside 7.36.0. In short: the start drops this issue reported are gone on both of its titles, the clock now waits 0.05 to 1.1 s for the first frames, and on one 4K AV1 title the gate timed out at the start and after every seek.Setup. Apple TV 4K (3rd generation,
AppleTV14,1), now on tvOS 27.0 (24J361); the issue's runs were on tvOS 26.6. Debug builds of our app, in one sitting on the evening of 20 October (US Eastern): 7.36.0, then 7.44.0, then 7.36.0 again, each run in a fresh process; 7.44.0 with none of its optional traits enabled. FFmpegBuild also differs between the two (3.7.1 and 3.9.0). Full-screen VOD played direct from Jellyfin through our loopback route. The issue's two titles were resumed at 30 s and switched in place to the software path by our app's 60 s no-picture check, with our test hook hiding the first frame from that check, as in the issue; The First 9½ Weeks was switched the same way without the hook. The VC-1 and AV1 titles start on the software path (our app's check readshardware AV1 decode: falseon this Apple TV).What we see. Seconds after the session's first
[AudioOutput] seekClockline, median [range] over n runs per version, 7.36.0 → 7.44.0. Dropped frames are thelayerDropincrements in the[SWDiag]ticks: at a start, from the first frame to 2 s (and to 15 s) after it; after a seek or the unpause, to 15 s after it or the next seek, whichever comes first. "Moving" is the later of the first[SWHost] layer.isReadyForDisplay=trueand the clock starting: on 7.36.0 the clock runs at once (back-dated from the first running tick); on 7.44.0 it startsprerollStartLead(0.25 s) after theprerollline, as the next tick confirms.prerollon 7.44.0preroll ready after 123 ms).audioRoute changed reason=2, no ports) before the switch (its 7.36.0 pair dropped 0), and the in-place reload after the same kind of drop in one 7.44.0 run of The Lowdown and in the 7.36.0 run of The Act of Killing (17 and 14 drops in about 3 s after each reload).On the DV clip the first
[SWDiag]tick after the first frame read the clock 0.953 s past the frame's pts on all three 7.36.0 runs, and 0.011 to 0.036 s behind it on 7.44.0. On 7.36.0 the clock still started 0.693 to 0.700 s before the first frame was enqueued on this tvOS (0.90 to 0.95 s on tvOS 26.6 in the issue). 7.44.0, run 1 (date, level and our log's own prefix cut, nothing else changed):From the logs (we have no recording): on the issue's two titles the picture now moves from its first frame instead of skipping 2 to 7 frames, and it starts moving 0.23 to 0.35 s later than the first picture appeared on 7.36.0. We cannot say how the held first frame looks on the TV.
The 4K AV1 title (Currahee, libdav1d with five threads, audio decoded) timed out at the start and after all five seeks; a second run of that title alone on 21 October timed out six times again (2,002 ms at the start, 2,001 ms after each seek). Its first picture was no later than on 7.36.0, counted from each
seekClockline: 3.248 against 3.268 s at the start; 2.86, 2.91, 2.86 and 3.82 s against 2.91, 3.13, 3.15 and 3.90 s after four of the five seeks (after the seek to 300 s neither version showed a picture before the next seek). So once the cap released, the clock still started 1.0 s before the first picture at the start and 0.6 to 1.6 s before it after the seeks, and the drops fell without reaching zero (187 → 84 over the 150 s). FFmpegBuild 3.9.0 against 3.7.1 (libdav1d unchanged) is a second possible cause of this title's drop change. The start, 7.44.0:One request. Our app ends a software session after five clock stalls of 1.5 s or more within 60 s, judged from the session's clock. On the first Currahee run it counted three of the held clocks as stalls (no session ended). We now treat the clock as held from a
seekClockline, while our clock still reads that position, until the nextprerollline plus 0.25 s, and the second run counted none. Two things the log text cannot tell us: which engine printed an[AudioOutput]line (they carry no engine identifier, and we run several engines at once for multiview), and that a hold has begun (seekClock to=reads the same whether the gate then holds or not, so we only learn that the gate exists after a firstprerollline). Would you consider exposing the hold as engine state or as a per-engine callback (when it starts, when it is released, ready or timed out, and for which engine), so that a host does not have to read log lines?7.44.0 is our app's engine pin as of today (2026-10-21).
fix(sw): the preroll holds while the decoder is still working, and pu…
Merge fix/800-preroll-progress: the preroll holds while the decoder i…
superuser404notfound commentedon Oct 24, 2026
Thanks for the device round, and for the 7.37.0 correction. The per-title table is exactly what was needed: on the two titles this issue was about, the start drops are gone, and the gate opened every time.
4K AV1 timing out. The gate gave up after a flat 2 s from the
seekClockline. On Currahee libdav1d needs 2.9 to 3.9 s to decode from the keyframe up to the target, so the timeout started the clock before the first frame at the target existed, and the frames due in between dropped. Since 97e32c5 on main (merged in 88a459e, not released yet) a hold no longer gives up on a decoder that is still working. It waits as long as the decoder keeps producing frames, including the ones it discards on the way to the target, up to 6 s. A decoder that produces nothing for 2 s still times out as before. On that title the sixtimed outlines should becomepreroll ready after ~3000 ms, with the clock starting on the first frame instead of 0.6 to 1.6 s ahead of it. The picture will not arrive any sooner, it just will not be chased. The steady-state drops (84 over 150 s) are a separate question. If libdav1d at five threads is that close to real time on the A15, they come from decoder throughput, not from the start, and this change will not touch them.The hold as engine state. Done in the same commit. Each
AetherEngineinstance now has:isClockHeld(@Published): true while the clock stands at rate 0 waiting for frames.clockHoldEvents(AnyPublisher<ClockHoldEvent, Never>):.began, then exactly one.released(ClockHoldRelease). The release is.ready(waitedSeconds:),.timedOut(waitedSeconds:)or.cancelled. A newer seek, a pause, a rate change or the end of the session releases a waiting hold as.cancelledfirst, so holds never nest.Both are per instance, so each engine in a multiview reports its own holds. The clock starts 0.25 s after
.readyor.timedOut. A start whose frames are already queued does not hold and emits nothing. The AVPlayer paths, the audio-only host and live streams off the FEL route never hold. It is documented indocs/api.mdnext toseekEvents.I'll leave this open until the AV1 title has been measured on a release that carries it.
test(sw): drive the preroll progress test from the hold's own poll, n…
superuser404notfound commentedon Oct 26, 2026
Released in 7.48.0 (263dc11). Leaving this open for the retest.
Merge upstream AetherEngine 7.38.1 (fc6b412) into the Silo fork