Repository navigation
Description
What happened?
This is the continuation of the #143 residual you fixed in 5.15.2. That fix is real and I can
confirm it working — but it is incomplete on the most common authored shape.
I seek so as to land inside a PGS cue's span on a stream without an acquisition point covering
the landing. Expected: the line I land on is shown. Instead: the landing-span line is decoded
but never published to the cue surface — the overlay stays empty until the next authored
composition. Forced cues are affected too.
5.15.2 fixed the shapes where nothing is stored ahead of the landing (an open-ended line, or a
clear beyond the lead window). What is STILL dark at 5.20.2 is the shape where the landing
line's own zero-object CLEAR display set sits inside the ~60 s lead window — which is the
normal authored shape, since nearly every subtitle line has a clear a few seconds later. All
three shapes from my original residual report remain dark, plus an EOF case.
Steps to reproduce
Two-line delta from the fixtures already in the #143 discussion:
- Author (or reuse) a PGS stream with a line that shows at T and clears at T+n (n small), with
the next SHOW composition far away (tens of seconds) and no acquisition point in the lead-in. - Seek to land inside [T, T+n]. Observe: the landing line never paints; applySubtitleEvent
fires for it, but no cue ever publishes (20 s settles). - Contrast (paints correctly): move that clear to BEYOND the ~60 s lead window, or drop it
entirely (open-ended line). The 5.15.2 finalize then fires and the landing line paints.
The only variable between "dark" and "paints" is whether the landing line's own clear sits
inside the lead window.
AetherEngine version or commit SHA
5.20.2 / e2dcbb9 (FFmpegBuild 2.2.0 e832f22c, LibDovi 1.0.2) Baseline for the side-by-side: 5.9.7 / f943245 (FFmpegBuild 2.1.2), same fixture bytes.
Host app
Custom / my own integration
Platform
macOS
OS version
macOS 26.5.2 (build 25F84), arm64
Device / chip
Apple Silicon Mac (Mac16,9), arm64
Playback path
Native AVPlayer
Source media (for playback bugs)
PGS subtitle streams without acquisition points: a 660 s authored fixture and a purpose-built
disambiguation fixture (b0-clearshape) whose only variable is the position of the landing
line's clear. MKV/HEVC container; the defect is subtitle-side. SUP authored via tools/pgs_author.py;
mux = -c copy of the archived 660 s video track.
Error codes / log lines
No error is logged — the landing line is silently withheld. Decode-but-withhold signature,
identical in every dark cell:
applySubtitleEvent … cueStart=300.000s … currentTime=302.300s (fires)
→ no cue ever appears on $subtitleCues under any id (20 s settles)
Measured matrix (5.9.7 → 5.20.2, identical fixture bytes; each row = dump + engine-log sidecar):
mid-cue, file's LAST line, clear@170 in window (seek 165 → 160→170) dark → dark
exact-boundary, own clear@33 in window, next show 90 s away (seek 30) dark → dark
mid-FORCED cue, own clear@304 in window, next show ~296 s away (seek 302) dark → dark
EOF landing, own clear@658 in window (seek 656 → 655→658) dark → dark
mid-cue, clear BEYOND the 60 s lead (seek 210 → 200 show, clear@280) dark → PAINTS (5.15.2)
EOF landing, NO clear at all (seek 656 → 655 open-ended) dark → PAINTS (5.15.2)
mid-cue with successor SHOW in window (seek 600 → 598, next 605) paints → paints
Anything else
Mechanism (a source read, offered as hypothesis): the 5.15.2 finalize gate is
SubtitleOverlayDrainer.shouldFinalizeReconstruction(reconstructing:hasCandidate:hasSuccessorAhead:),
with hasSuccessorAhead = !store.entries(from: playhead.nextUp, through: playhead + lead).isEmpty.
The packet store counts the landing line's own zero-object CLEAR display set (a stored packet),
so the finalize never fires when the clear is inside the lead window. Meanwhile the normal
pass-end trigger (admitDuringReconstruction) only flushes the held candidate when a composition
at/after the playhead decodes into the pass — and a zero-object clear never does (no
applySubtitleEvent fires for the clear in any dark run). The landing falls exactly between the
two conditions. The Issue143PGSLandingLineTests shapes (nothing stored ahead) pass; the
authored-clear shape has no covering test.
Suggested direction (yours to choose): either exclude zero-object display sets from the
hasSuccessorAhead probe (a clear cannot end the pass, so it should not veto the finalize; the
landing line's end still trims to the clear's PTS), or let the clear's decode act as a pass-ender
that emits the held candidate when the clear's PTS is after the playhead.
Aggravator: forced cues are affected (the 302 s cell is a forced line), so a forced sign you seek
onto can silently vanish.
Honest scope: authored fixtures (no APs / sparse), macOS oracle. The two "paints" cells are the
controls that isolate the clear-in-window variable. Fixture + dumps available on request.
x-ref: #143 (this is its residual), the 5.15.2 fix (real, confirmed working on the shapes it
targets), #163 (the external-sidecar end rule, related lineage).
Activity
superuser404notfound commentedon Jul 24, 2026
Fixed in 5.20.6 via #211.
The reported mechanism was exactly right. The 5.15.2 finalizer used raw packet presence after the playhead as its successor test. A zero-object PGS
CLEARtherefore vetoed finalization even though it carried no cues capable of endingadmitDuringReconstruction. The clear still trimmed the held landing candidate correctly, leaving a bounded but permanently withheld cue.The drain now treats the decoded gate state as authoritative after processing the window. A renderable successor already ends reconstruction while decoding. If reconstruction remains active with a seeded candidate, a clear-only successor no longer blocks finalization, and the published landing cue keeps the authored clear PTS as its end. Forced cues and end-of-file landings follow the same path.
Covered by
Issue204PGSClearLandingTestsplus the existing #143 and #146 reconstruction suites. The full macOS suite and iOS/tvOS Simulator CI are green.Thank you for the clean clear-position matrix that isolated this residual. The issue remains open for a fixture/device retest.
cmcpherson274 commentedon Jul 27, 2026
Confirming the 5.20.6 fix (#211): re-ran the full landing battery today at 5.23.11 on the same
fixture bytes — all four previously-dark shapes (within-lead clear, forced landing, EOF landing,
no-clear landing) publish with END equal to the authored clear PTS exactly. This shape is fixed
and has held 5.20.6 → 5.23.11. Good to close from my side.
One adjacent heads-up: the same battery found the COMPLEMENTARY shape (landing whose only later
display set is beyond the 60 s lead — the one 5.15.2 itself fixed for #143) regressed in
5.23.11; filed separately with a bisection and fixture: #234
fix(subtitles): anchor the prefetch seek on the subtitle axis (superu…
superuser404notfound commentedon Jul 28, 2026
Thanks for the retest, and for running the full battery on the same fixture bytes across three releases. Closing on that confirmation.
The complementary shape is handled as well. #234 turned out to be the seek anchor rather than the #230 park: the side reader calls
avformat_seek_file(ctx, -1, ...), so libavformat picks the reference stream itself by score, andav_find_default_stream_indexawards +200 to any stream that is not onAVDISCARD_ALL. Up to 5.23.10 the subtitle stream was the only one that qualified and won 200:75, which means the positioning was on the subtitle timeline by accident rather than by request. The #230 pacing stream sits atAVDISCARD_NONKEY, collected the same +200, and video won 275:200, so the landing display set ended up in an earlier cluster that was never read.Demuxer.seekBounded(to:anchorStreamIndex:timeout:)now takes the anchor explicitly and converts the target into that stream's time base. Released in 5.25.1, with the same defect fixed on the native reader path in 5.25.2, and green on the retest there. #234 is closed.For the record on this thread:
Issue204PGSClearLandingTestsandIssue234SideReaderSeekAnchorTestsboth pass on the 5.27.0 tip, so the clear-only successor shape and the beyond-lead successor shape now guard each other in CI.Appreciate the bisections and the fixtures on both of these, they made the difference between guessing and measuring.