Repository navigation
Description
main @ db98d9f, tvOS 26.5, Apple TV 4K 3rd gen, loopback-HLS native path. Asset: 4K DV Profile 8.1 HEVC MKV, ~2 h 07 m, TrueHD source audio (FLAC path), three PGS subtitle tracks (the demuxer logs Could not find codec parameters … unspecified size for all three at open).
Reading AetherEngine+Subtitles.swift, PGS cues insert into subtitleCues as read, with a placeholder endTime (start + 0xFFFFFFFF ms), and the next composition's pgsTrimAt trims the predecessor. In steady state the trim lands within a frame of the insert and nothing untoward shows. But when the side reader falls behind and then catches up (the #96 starvation class — here after a backward seek plus pause/resume), the backlog cues arrive already in the past: each one's window instantly covers the playhead the moment it inserts, so it renders until its successor's trim arrives a beat later. On screen that's a rapid burst of stale subtitles "catching up" — ~17 cues spanning 80 s of content applied over 9 s in this capture:
17:30:18.253 embedded subtitle reader started: stream=5 startAt=356.44s effectiveStart=356.44s seekTo=354.44s (anchor correct)
17:30:19.516 subtitle first cue: pktPTS=358358 → startTime=358.358s endTime=4295325.653s
17:30:19.562 [applySubtitleEvent #1] cueStart=358.358s cueEnd=4295325.653s engine.currentTime=356.439s
17:30:19.798 [applySubtitleEvent #2] cueStart=360.735s cueEnd=4295328.030s engine.currentTime=356.439s
17:30:22.851 [applySubtitleEvent #3] cueStart=385.719s cueEnd=4295353.014s engine.currentTime=356.439s
17:30:25.502 [applySubtitleEvent #4] cueStart=408.533s cueEnd=4295375.828s engine.currentTime=356.439s
17:30:25.616 [applySubtitleEvent #5] cueStart=409.910s cueEnd=4295377.205s engine.currentTime=356.439s
17:30:25.747 [applySubtitleEvent #6] cueStart=411.328s cueEnd=4295378.623s engine.currentTime=356.439s
17:30:26.122 [applySubtitleEvent #7] cueStart=414.623s cueEnd=4295381.918s engine.currentTime=356.439s
17:30:26.328 [applySubtitleEvent #8] cueStart=416.499s cueEnd=4295383.794s engine.currentTime=356.439s
17:30:26.606 [applySubtitleEvent #9] cueStart=418.335s cueEnd=4295385.630s engine.currentTime=356.439s
17:30:26.924 [applySubtitleEvent #10] cueStart=420.712s cueEnd=4295388.007s engine.currentTime=356.439s
17:30:27.086 [applySubtitleEvent #11] cueStart=422.005s cueEnd=4295389.300s engine.currentTime=356.439s
17:30:27.269 [applySubtitleEvent #12] cueStart=423.256s cueEnd=4295390.551s engine.currentTime=356.439s
17:30:27.537 [applySubtitleEvent #13] cueStart=425.300s cueEnd=4295392.595s engine.currentTime=356.439s
17:30:27.824 [applySubtitleEvent #14] cueStart=427.677s cueEnd=4295394.972s engine.currentTime=356.439s
17:30:28.198 [applySubtitleEvent #15] cueStart=430.972s cueEnd=4295398.267s engine.currentTime=356.439s
17:30:28.533 [applySubtitleEvent #16] cueStart=434.017s cueEnd=4295401.312s engine.currentTime=356.439s
17:30:28.869 [applySubtitleEvent #17] cueStart=436.519s cueEnd=4295403.814s engine.currentTime=356.439s
(The excerpt above is the reload-at-position case where the reader races 80 s ahead of a parked playhead; the user-visible burst in the same session was the mirror case — the playhead 80 s ahead of a starved reader — where each late cue's startTime is already behind currentTime, so it renders the instant it inserts and is replaced when the next one lands. Full window available if useful.)
Note this is not the fixed #52 stale-anchor class — the reader anchors correctly (seekTo=354.44 for a 356.4 s playhead) — and it's distinct from #96's first-cue stall, though the same starvation is what creates the catch-up condition. A cue that arrives with startTime already behind the playhead (or behind a newer cue in the same batch) could insert pre-trimmed to its successor's start (or be window-tested against the batch before publish) instead of flashing through the live overlay one by one.
Activity
fix(subtitles): hold stale PGS arrivals for successor resolution inst…
superuser404notfound commentedon Jul 4, 2026
Fixed on
main@ f199c2c. You called both workable directions; what shipped is the window-test variant with successor resolution, as a holdback gate in front of the overlay publish:A PGS event whose cues start more than 5 s behind the playhead is a catch-up replay and is now HELD instead of published. The next PGS composition (or clear event) resolves it: trimmed to the successor's start, the cue publishes only if that true window covers the playhead, i.e. it is the genuinely active subtitle, and is dropped silently otherwise. Your 17-cue capture replays as a unit test: cues 358.358 through 430.972 resolve to history and never touch the overlay; 434.017 lands inside the epsilon, passes straight through, and is in fact the active cue (true window 434.017-436.519 covers the 436.4 playhead).
Steady state and the seek-landing case are byte-identical to before: a cue starting within 5 s of the playhead (the reader anchors ~2 s back after a seek, and its first cue must render immediately) is never held, and cues ahead of the playhead insert as always.
One trade-off to be aware of when you test: the LAST cue of a backlog has no successor yet, so it stays held until the next composition arrives. If that cue happens to be the genuinely active one, it shows up a beat late (when the next composition or clear lands) instead of instantly. I considered resolving holds on a wall-clock timeout instead and rejected it: your inter-decode gaps run to ~2.6 s, which exceeds any timeout that would still suppress the burst, so a timeout would only thin the flashes rather than eliminate them.
Retest: same repro (backward seek plus pause/resume into a starved reader on the PGS asset). Expected: no catch-up burst; at most one subtitle appears, and it is the one that actually belongs at the playhead. Note this intentionally does not touch the starvation itself; that stays #96.
rrgomes commentedon Jul 4, 2026
Retested on
58a295e: same bridged-audio 4K title, PGS subtitles — a rapid backward scrub no longer flashes the backlogged cues one-by-one; they resolve cleanly. Field-confirmed on device, no burst (a8f63ab holdback). Resolved from our side — fine to close.superuser404notfound commentedon Jul 5, 2026
Thanks for the device retest and the confirmation. Closing as resolved: the
PGSStaleArrivalGateholdback (a8f63ab, shipped in f199c2c and present in your tested 58a295e) does its job, the catch-up backlog resolves cleanly with no per-cue flashing.For completeness: the underlying side-reader starvation that produced the backlog in the first place is tracked separately in #96 and stays open. This issue was only ever about the overlay replaying that backlog as a burst, which is now gone.
Appreciate the careful captures throughout this one.
chore(release): 4.12.0
fix(subtitles): single-pass PGS reconstruct so a remote Blu-ray shows…
fix(subtitles): rework PGS seek/audio-switch reconstruction as a reta…
fix(subtitles): drainer backscan runs through the gate's reconstructi…
fix(swplayback): name a software session that decodes into nothing (s…
fix(subtitles): retire a placeholder cue end the seek outran (superus…
fix(subtitles): a landing line has to stand on ground somebody read (s…