Repository navigation
Description
What happened?
On the software host, seek(to:) on a paused session lands (currentTime at the target, state == .paused), but the picture does not change. The layer keeps the frame from before the seek until play().
I expected the frame at the landed position. The native route does that ("a paused scrub lands paused, presenting the new frame", changelog entry for #122), and since 7.57.0 a paused mount and a paused rebuild do it on the software host too (#973). This is the case #973 did not cover: a host that has already played, is paused, and is then moved.
What I read in the source at 7.62.1 (the same on main at db92bf6):
Sources/AetherEngine/Native/SoftwarePlaybackHost.swift,seek(to:): the flush keeps the old frame on purpose (renderer.flush(removingDisplayedImage: false), Software-path seek blanks the display (flushAndRemoveImage) → black flash; should hold the last frame like the hardware path #90), and the paused branch only anchors the clock (audioOutput?.seekClock(to: targetTime, rate: 0),pausedByHost = true). Nothing asks for a decode at the landing.- The loops stay parked. They read only while
PausedFirstFrame.loopsMayRun(isPlaying:pausedBeforeFirstFrame:)is true (throughSeekWindow.loopMayRead(isPlaying:windowOpen:)).pausedBeforeFirstFrameis set only inpause(), and only for a host with no frame yet (PausedFirstFrame.holdsForFirstFrame,startsLoopsForFirstFrame).framesEnqueuedis never reset, so a host that has shown a frame does not get the hold back after a seek. - The comment at
demuxDiag.audioFlushed(generation:)inseek(to:)says the same: "the pump learns of this seek only at its next iteration, which a paused landing never reaches until play()".
Steps to reproduce
-
Make a file whose picture tells its time (flat grey, luma = 16 + 6 * t, 30 s, HEVC, 2 s GOP):
ffmpeg -f lavfi -i "color=c=black:size=640x360:rate=24:duration=30,format=yuv420p,geq=lum='16+6*T':cb=128:cr=128" \ -f lavfi -i "aevalsrc=0.2*sin(2*PI*440*t)|0.2*sin(2*PI*660*t):s=48000:c=stereo:d=30" \ -map 0:v -map 1:a \ -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709:range=tv" \ -c:v libx265 -preset ultrafast -crf 18 -pix_fmt yuv420p -tag:v hvc1 \ -x265-params "keyint=48:min-keyint=48:colorprim=bt709:transfer=bt709:colormatrix=bt709" \ -c:a aac -b:a 96k -metadata:s:a:0 language=eng \ ramp.mkv
-
Load it on the software host (
LoadOptions.preferredDecodePath = .software), let it play to about 2.7 s, callpause(). -
await seek(to: 12.67). -
Read the frame the engine's
AVSampleBufferDisplayLayerdisplays (layer.sampleBufferRenderer.displayedPixelBuffer()): mean luma of the centre, then(luma - 16) / 6is its time.
Result: two seconds after the landing the displayed frame still reads 2.83 s, with currentTime at 12.67 and state == .paused. After play() the picture is right.
aetherctl play --sw --host-calls pauseseek ramp.mkv looks like the same sequence (pause at t=12, seek at t=15, play at t=20). docs/cli.md says of that drill that its paused ticks show "what the [SWDiag] line reports while the pump is parked and has not heard of the seek", so I would expect enq=+0 on the [SWDiag] lines between SEEKLANDED and the play(). I have not run the harness.
AetherEngine version or commit SHA
7.62.1 (d879ef8), by reading the code only. The picture was measured on 7.55.0 and not re-measured since: on 7.58.0 and on 7.62.1 I only re-read the code. The #973 change in 7.57.0 starts loops that never ran and does not touch a seek, and between 7.58.0 and 7.62.1 SoftwarePlaybackHost.swift changed only for the E-AC-3 JOC route, the live DVR byte budget and the PGS palette flag. PausedFirstFrame.swift and SeekWindow.swift did not change at all.
Host app
Custom / my own integration
Platform
tvOS
OS version
tvOS 27.2 (Simulator)
Device / chip
Apple TV 4K Simulator on an Apple silicon Mac. Not measured on an Apple TV.
Playback path
Software (dav1d) host
Source media (for playback bugs)
MKV, HEVC 8-bit 4:2:0 (libx265), 640x360, 24 fps, SDR, a keyframe every 2 s; AAC-LC stereo 48 kHz; 30 s (the recipe above). Loaded with load(source: .custom(reader)), a custom IOReader. The simulator has no hardware HEVC decode, so the session is on the software host either way.
Error codes / log lines
None. No error is raised and the seek is reported as a normal landing.
Anything else
What the host does meanwhile: about 300 ms after a paused seek lands on the software host it calls reloadAtCurrentPosition(), and the rebuilt host presents the frame (#973). That is a full session rebuild, with the container reopened, for every paused jump, which is slow on a network source.
A possible direction, since the mechanism exists: after a paused landing, run the loops under the hold pause() already uses before the first frame, until the first frame at or past the seek target is in, then park again.
Prepared with an AI coding agent that works on the host app. Every measurement named above comes from its test runs on the versions stated; what was only read in the code is marked as such.
Activity
fix(swhost): a paused seek presents the frame it landed on (#1023)
superuser404notfound commentedon Nov 11, 2026
Thanks for the precise report and the ramp fixture, that made this quick to pin down.
Fixed on
mainin a8fcbb9 (merge 10f1b33), not released yet.What changed
pause()uses before the first frame, at the stopped clock, until the frame at the landing is in. Then they park again. A landing that plays drops a hold an earlier paused landing left standing.frame at 27.042s arrived after 27.125s was handed over). That affected the pre-first-frame case too.Measured with your recipe (
ramp.mkv),aetherctl play --sw --host-calls pauseseek, landing at 27.02 s:SEEKLANDED, untilplay()enq=+0,r4d=n,cur=27.02#104 first frame in under the pause: pts=27.000s clock=27.019s,enq=+2,r4d=y,cur=27.02This was on macOS, where the session decodes HEVC through VideoToolbox, so your simulator route (libavcodec) was not measured directly. The new host test (
Issue1023PausedSeekFrameTests) covers the hold, and a renderer test covers the coding-order handover.Once this is in a release, your ~300 ms
reloadAtCurrentPosition()after a paused jump should no longer be needed. I'd appreciate a re-check of the displayed-luma measurement on your side when you get to it.superuser404notfound commentedon Nov 12, 2026
Released in 7.63.0 (
f81a8b5b).Desima-AP commentedon Nov 13, 2026
Rechecked the displayed-luma measurement on 7.63.0 (
f81a8b5b), on the route you could not measure. It holds, and our reload after a paused jump is removed.Setup: a tvOS host app on the tvOS simulator: software host, HEVC decoded by libavcodec, read through our custom
IOReader(fed from a local file here). Fixture: the ramp recipe from the report; we read the luma of the frame on the engine's layer.With our
reloadAtCurrentPosition()taken out, paused, thenseek:reload beginin the log.play()right after a landing: plays on from the landed moment.reload begin, the switch's own.On 7.62.1 the two positions where our reload never ran (0.5 s into the film, 0.3 s before the end) kept the old frame.
One more case, because every seek above was served from the packet cache (the ramp file is small): a reader that withholds the second half of the file for a second. Paused at 2.74 s, seek +22 s; the log reads
packet cache seek generation=1 result=miss target_s=24.737 resident_bytes=0. While the reader was silent the session reported seeking and the old frame (2.67 s) stayed. Once it answered, the frame of 24.67 s was on the layer at position 24.75 s, paused, with no reload.Not measured: a real Apple TV, so nothing on hardware decode with B-frames (the reorder case you fixed alongside).
Done from our side.
Merge upstream 7.65.0 into rediffusion-hdhomerun-7.39
superuser404notfound commentedon Nov 13, 2026
Thanks for the thorough re-check, especially the slow-reader case. I had not covered that one, and it is good to see the landing frame arrive once the cache miss is served.
The coding-order case is the one I measured on the Mac (VideoToolbox), so between the two of us both decode routes are covered. Closing this as fixed in 7.63.0. If an Apple TV shows something different, reopen or file a new issue.