Skip to content

Loopback drainer: a seek landing mid-cue (or exactly on a display-set boundary) on a PGS stream without acquisition points never re-shows the landing line — including forced cues — until the next composition #143

Closed

Description

@cmcpherson274

What happened?

I seeked into a PGS cue's span (or exactly onto a display-set start boundary) on a stream with no
acquisition point covering the landing.

Expected: the line the viewer landed on to be shown.

Instead: the landing-span line is never painted; the overlay stays empty until the next authored
composition arrives. Forced cues are affected too. Successor cues re-emit normally (fresh ids), so
everything AFTER the landing is fine — only the line you land on is lost. On sparse dialogue the
blackout runs tens of seconds.

Steps to reproduce

  1. Play a PGS stream whose lead-in to your landing point has no acquisition point / Epoch Start
    (sparse-palette authored content, or a server-drained stream).
  2. Seek to land mid-cue, or exactly on a cue's start boundary, or backward into cache-resident
    content.
  3. Observe the overlay: the landing-span cue is never (re)painted; the next authored cue paints
    normally. A "first new cue after seek" instrument will look fine — it counts the NEXT cue, not
    the missing landing line.

AetherEngine version or commit SHA

5.5.1 / 33565b2 (FFmpegBuild 2.0.0)

Host app

Custom / my own integration

Platform

tvOS

OS version

macOS 26.5.2 arm64 / tvOS 26.5

Device / chip

Apple Silicon Mac (arm64) + Apple TV 4K (3rd gen, 2022) / AppleTV14,1

Playback path

Native AVPlayer

Source media (for playback bugs)

PGS subtitle streams without acquisition points: authored fixtures (no APs / sparse palette
updates), a 660 s authored fixture, and a real server-backed session. MKV/HEVC video; the defect is
subtitle-side.

Error codes / log lines

No error is logged — that is part of the problem (the landing line is silently discarded).
Measured matrix:
- macOS: far-fwd mid-line (165 s) & backward into cache (22 s) drop the landing line 14/14
  batteries; exact-boundary landing (seek to 120.0) drops it 13/14 (the 1 exception is a separate
  mangled-timestamp fixture).
- 660 s authored fixture: 3/3 mid-line landings paint nothing, including the FORCED cue at 302 s.
- tvOS sim: seek→600 only the 605 s cue paints; seek→30 no cue within 8 s.
- tvOS hardware, server session: 30 s & 302 s landings → no cue within 8 s; 600 s landing → the
  landing-span cue (598.515–600.517) never re-shown, next cue (pts 605) painted at 737 ms.

Anything else

Mechanism (a code read, offered as hypothesis): Sources/AetherEngine/Subtitles/
Issue100PGSStaleArrival.swift:82-97 — the post-seek reconstruction pass seeds its active-line
candidate "only from a self-contained composition" (an Acquisition Point / Epoch Start). With no
such composition in the lead-in, no candidate is seeded and the landing line is discarded.

Relation to existing issues: #100 (this lives in the gate built for that fix — the catch-up-burst
itself IS fixed; but for AP-less streams two statements in that thread don't hold as measured: the
seek-landing case is not byte-identical, and the held line doesn't show "a beat late" — it never
shows); #125 (NOT a regression — its 5.0.5 fix holds: successor re-emission 56/56, zero integrity
violations; this is the residual landing-span line); #112 ("shows the line currently being spoken
immediately" is exactly what the seek-landing case fails to deliver); #96 (dense-dialogue
first-cue-latency retests can't see this).

Aggravator: forced cues are affected and there's no per-cue forced flag on the engine surface
(only TrackInfo.isForced), so a host can't even detect a dropped forced line. (We're filing the
per-cue forced-flag API gap separately, in a related issue.)

Honest scope: our hostile shapes are authored (no APs / sparse). Full-palette BD rips with periodic
acquisition points were not swept — on real library content we have a hint the landing cue CAN
arrive — so we claim this for AP-less/sparse shapes, not all content.

Fix directions (offered): let the reconstruction pass fall back to seeding from the newest
decodable non-self-contained composition; or run the decoder from the nearest epoch start behind
the backscan window.

Version note: 5.5.1; no release 5.6.0–5.8.6 mentions PGS (post-pin subtitle work is
teletext/CEA-608), so we expect this holds at HEAD — happy to re-test. Dumps + engine-log sidecars

  • the 660 s fixture available on request.

Activity

  1. added
    bug
    on Jul 19, 2026
  2. superuser404notfound commented on Jul 19, 2026

    @superuser404notfound
    Owner

    Fixed in 5.9.3 via #149.

    Your code read was spot on. The #112 reconstruction pass seeded its active-line candidate only from a self-contained composition (Acquisition Point / Epoch Start), so on AP-less/sparse-authored streams no candidate was ever seeded and the landing-span line was discarded, while the pass-ending successor published normally. That also explains the exact-boundary batteries: by the time the drain tick decodes the backscan, the playhead has advanced a few frames past the boundary, which turns the boundary landing into the mid-cue shape.

    The fix is your first suggested direction: the candidate is now seeded from any successfully decoded composition behind the playhead. The drain decoder is rebuilt fresh at the backscan start, so a set whose palette/object references are missing fails decode and never reaches the gate, meaning anything that decodes is renderable, and the steady-state path outside reconstruction already publishes Normal compositions unconditionally. The #112 no-scroll invariant is unchanged (lead-in lines stay held; only the newest at/behind the playhead emits once the decode reaches the playhead).

    Widening the seed exposed a second hole, also fixed: a PGS clear carries no cues and never reached the gate's admission, so a candidate cleared before the playhead kept its open placeholder window and would have resurrected as the active line at pass end. The per-composition trim broadcast now closes the candidate's window too, and a clear ahead of the playhead bounds the emitted landing line at the authored clear.

    Covered by Issue143PGSLandingLineTests (mid-cue landing, boundary landing with an advanced tick playhead, the no-scroll invariant on Normal-only content, cleared-line non-resurrection in both Normal and acquisition-point variants, ahead-clear trimming, candidate refinement); 6 of the 7 failed on 5.9.2.

    On your honest-scope note: this covers landing sets that are standalone-decodable (your authored fixtures, and any Normal set carrying its own PDS/ODS). Content whose landing sets truly depend on state from before the backscan window would need the epoch-start-aware backscan (your second direction); the PCS classification the gate receives is kept in place for exactly that, so if you have real content in that shape, a fresh issue with a sample would be the right vehicle. A retest on your 660 s fixture and the server-backed session would be very welcome.

  3. cmcpherson274 commented on Jul 20, 2026

    @cmcpherson274
    Author
    Re-ran the batteries against 5.9.7: the fix works for every landing shape that has a
    successor composition within the drain window — measured on both our fixtures:
    
    - mid-cue backward landing (seek 22 into a 20→24 line): landing line now re-emits;
    - exact-boundary landing (seek 120.0): the 120 s line now paints;
    - mid-cue far-forward landing (seek 600 into 598→601): the 598 line now paints
      (firstSeen in the seek epoch, correct bounds).
    
    One residual, deterministic across 3 shapes × 2 runs each (8 s battery settles AND 20 s
    single-seek settles): when the landing set is the newest decodable composition and NO
    further composition exists within the ~60 s forward window, the landing line decodes but is
    never published. Our three repros:
    
    - seek 165 into a 160→170 line that is the file's last composition:
      applySubtitleEvent fires (cueStart=160.000, currentTime=165.300) — no cue publishes;
    - seek 30.0 exactly onto a 30→33 line whose next composition is 90 s away:
      applySubtitleEvent cueStart=30.000 at currentTime=30.000 — no cue publishes;
    - seek 302 into our FORCED 300→304 cue, next composition ~296 s away (fresh session,
      20 s settle): applySubtitleEvent cueStart=300.000 at currentTime=302.300 — no cue
      publishes.
    
    The publish/withhold split in our data is perfectly predicted by successor-presence — not by
    landing kind (boundary vs mid-cue vs forced) or seek direction — which reads like the
    candidate's emission is successor-/pass-end-triggered and an isolated landing line has no
    trigger. Sparse content (the case where the blackout hurts most) is exactly the shape that
    stays broken, forced cues included.
    
    Minor observation while re-testing, for completeness: at the 120-boundary landing the pass
    also emitted the 90 s line with end=120 (closed at the successor's start rather than its
    authored 95/100 clears). Invisible on screen — the span expires exactly at the landing
    playhead — noted only because the emitted historical span differs from the authored timeline.
    
    Happy to re-run against a fix; dumps + engine-log excerpts available on request.
    
  4. superuser404notfound commented on Jul 20, 2026

    @superuser404notfound
    Owner

    Fixed in 5.15.2 (ddebe0e), and thank you for pinning the residual to successor-presence so cleanly.

    Your read is exactly right. The reconstruction candidate's only emit path was the pass-end trigger in admitDuringReconstruction: it flushes the held active line when a composition at or after the playhead decodes. A landing whose display set is the newest decodable composition in the drain window has no such trigger, so on the sparse and last-line shapes the candidate seeded (which is why applySubtitleEvent fired with the landing cueStart) but never published, and reconstructing never cleared. The publish/withhold split tracking successor-presence rather than landing kind or seek direction is precisely that.

    The fix gives the pass a successor-independent end. On each drain tick, once a candidate is seeded and nothing is stored ahead within the forward lead window (60 s), the drain finalizes the pass: it emits the candidate active line (the whole same-start group, so a forced sign and its dialogue both paint) once and clears reconstructing. Your three repros are exactly this shape and now publish: the 160 last-composition landing, the 30.0 boundary landing with the next line 90 s out, and the 302 seek into the 300 to 304 forced cue with its neighbor ~296 s away. A line the author cleared before the playhead no longer covers it and is filtered out, so the no-resurrection invariant holds; landings that already had a successor in the window keep the existing path and are unchanged.

    On your completeness note (the 90 s line emitted with end=120 at the boundary landing): that is the emitted historical span closing at the pass boundary rather than the authored 95/100 clear, and as you observed it expires exactly at the landing playhead so it never draws. It is a separate, screen-invisible bookkeeping difference from the dark-overlay bug, and I have left it as is for now; if it ever surfaces visibly, a fresh issue with a dump would be the right vehicle.

    A retest on the 660 s fixture and the server-backed session would be very welcome, and the dumps plus log excerpts you offered would be helpful if anything still looks off.

  5. cmcpherson274 commented on Jul 23, 2026

    @cmcpherson274
    Author

    Re-ran the batteries at 5.20.2 (e2dcbb9): the 5.15.2 finalize is confirmed working for the
    shapes it targets — measured on two new control cells:

    • a landing whose clear sits BEYOND the 60 s lead (seek 210 into a 200 s show, clear at
      280): now paints (was dark at 5.9.7);
    • an end-of-file landing with NO trailing clear (seek 656 into an open-ended 655 show):
      now paints.

    But all three shapes from my original residual report are still dark at 5.20.2, plus a
    fourth (EOF): seek 165 into a 160→170 last line, seek 30.0 exactly onto 30→33 (next show
    90 s away), seek 302 into a forced 300→304 cue (next show ~296 s away), seek 656 into
    655→658. Same signature as before: applySubtitleEvent fires for the landing set, no cue
    ever publishes (20 s settles; 5.9.7 side-by-side on identical fixture bytes).

    The split between the fixed and still-dark cells is exactly the presence of the landing
    line's own CLEAR display set inside the lead window. Reading 5.15.2's gate: the finalize
    requires nothing stored ahead (store.entries(from: playhead, through: playhead+lead)),
    and a stored zero-object clear satisfies that probe — while the pass-end trigger in
    admitDuringReconstruction only fires when a composition decodes into the pass, which a
    zero-object clear never does. A landing line followed only by its own clear (the normal
    authored shape — nearly every line has one) falls between the two conditions and stays
    held forever.

    Repro is a two-line delta from the fixtures you already have: give the landing line a
    clear inside the lead window (dark) vs. move the clear past the lead / drop it (paints).
    My authored scenario + dumps available on request. Suggested read: a zero-object display
    set probably shouldn't count as a "successor" for the finalize probe (it can't end the
    pass), or alternatively the clear's decode could flush the candidate when its PTS is
    after the playhead — either way the landing's end still trims to the clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions