Skip to content

PGS display sets are closed by their successor instead of their own clear packet after a seek burst (loopback-HLS VOD) — spans of 77 s to 817 s where the source authors 2-4 s #362

Closed

Description

@rrgomes

On 6.21.0, after a burst of seeks, the published subtitle window carries display sets whose own clear packet was never applied. Each set is instead closed by whatever set turns up after it, so a 3.5-second set becomes a 77-second one and holds the overlay long past the moment the source clears it. Same asset, same stream, a clean pass gets it right — the contrast is at the bottom.

Asset: a 1953 feature, 1080p AVC, ~4740 s, with an embedded PGS stream at index 3 (FLAC main audio, AC-3 commentary). Direct play on the loopback-HLS native path. Happy to name the exact title if it saves you matching it against your own copy — just ask.

What the source authors. ffprobe -select_streams 3 -show_packets over the region, sizes included so the 30-byte clears are visible:

2692.356  25749      2713.836  10129      2716.088   9234      2769.141  12989
2695.902     30      2715.796     30      2719.342     30      2771.143     30

So the set at 2692.356 is authored to clear 3.55 s later, at 2695.902.

What the engine delivered. Our host mirrors subtitleCues and logs each window as received, before any host-side processing. The set at 2692.4 (engine id 248) arrived with no end, and was then progressively closed by later arrivals — never by its own clear:

t=2647.2   [email protected]
t=2587.9   [email protected]
t=2866.4   [email protected]      <- successor start, not the authored 2695.9
t=2821.5   [email protected]      <- a nearer successor
t=2743.5   [email protected]      <- nearer still; 76.7 s span, authored 3.55 s

Its neighbour behaved the same way: [email protected], authored clear 2715.796.

The user-visible result is a set on screen 51 s and 45 s past its own clear (playheads 2743.5 and 2758.8). Elsewhere in the same session the same shape produced spans of 366 s (3824.0→4190.2), 417 s (2528.5→2945.3) and 817 s (2426.0→3242.8).

The same region, decoded on a clean pass, four minutes later in the same session — the authored clear is applied and the span is right:

A separate run that entered the region with a single seek and then just played was flawless throughout: every set on its authored boundary (2952.8-2955.8, 2955.9-2958.3, 2958.5-2963.0, 2964.7-2966.6, 2966.7-2969.3, …). So the decode path can apply these clears; something about the post-burst path does not.

Correlation. Every occurrence followed a burst of seeks — the window above had 25 seeks in about two minutes, and the affected regions are ones the engine re-resolved with reason=reconstruction. A single-seek entry into the identical region never reproduced it in several attempts.

Probably the same fault, other face. In the same sessions there are stretches where sets are missing from the window altogether — a run of eleven authored sets between 2966.6 and 2988.5 arrived as two — so the overlay is blank where it should carry dialogue. If clear packets are being dropped on the reconstruction path, dropped picture-bearing sets would be the same accounting.

Repro. Play a PGS title, scrub hard (8–12 seeks, forward and back, not letting it settle), then land just before a dense-dialogue stretch and let it play. Compare the published window's ends against ffprobe's clear packets for the same range.

On our side, for completeness: we now cap how long any bitmap set may hold the overlay, because a laundered end is indistinguishable from an authored one by the time it reaches us. That converts the wrong subtitle into no subtitle — a mitigation, not a fix; the missing sets can only come from the engine. Worth noting we could not see any of this until we fixed our own window diagnostic, whose dedupe key covered only the four cues furthest from the playhead — it was silent through a 26-second hold. Mentioning it in case a similar sampling exists in the engine's own instruments.

Activity

  1. superuser404notfound commented on Aug 13, 2026

    @superuser404notfound
    Owner

    Reproduced both faces on a local fixture and fixed both. They turned out to be two different mechanisms, and the second one is the one your "probably the same fault, other face" paragraph is about.

    The end that was not the author's

    A PGS set has no end of its own, so whatever packet follows on the stream closes it. The drain decodes a window bounded at playhead + 60 s, and that forward edge falls wherever it falls. When it lands between a set and the clear a few seconds later, the set publishes with FFmpeg's open placeholder, the drain cursor moves on, and nothing ever goes back for the clear: the cursor only moves forward, and the next reset starts at whatever the next landing is. So the set is closed by whatever composition turns up next, which after a burst is tens or hundreds of seconds away. That is your 2692.356 exactly, and it also explains the progression in your log (2879.5, then 2806.1, then 2769.1): each pass closed it at the nearest thing it happened to decode.

    The clear was in the packet store the whole time. The pump harvests far ahead of the drain window, so the authored end was available at the moment the set published and nothing had asked for it. An open set now takes its end from the next stored packet on its stream, which is exactly the pgsTrimAt the successor would apply once the window reached it, and it runs over the whole retained window each tick rather than only over what this tick decoded.

    One structural detail was needed for the store to be able to answer: the forward prefetch parked at playhead + 60 s too, so the set at the window's edge was systematically the one whose clear was stored nowhere. It now parks a 15 s margin past the drain window. That costs no extra bytes over a session, the reader is sequential either way, the park only decides when.

    The missing sets

    Different mechanism, same report. A seek restarts the segment pump behind the landing and it fills forward, while the store still holds an island the previous run harvested further ahead. The window then reads as "packets, hole, packets", and the drain decoded straight across it and carried the cursor to the far side. The hole's packets arrive a second later and are never read, so that stretch has no subtitles at all until some later seek happens to reset the window behind it, and the set before the hole is closed at the island rather than at its own clear. Eleven sets arriving as two is exactly that shape.

    The size of the gap cannot tell a hole from a silence the author left, and a threshold on it is actively harmful: a set is separated from its own clear by its display duration, so a 3 s rule stopped the tick at every authored line and delivery fell to a sixth of the sets. Harvest ORDER can tell them apart. A run reads a stream forwards, so within one run PTS and sequence rise together, and a PTS-ascending pair whose sequence descends is two runs meeting over a span neither has read. A tick now stops at that boundary. Three bounds keep the wait from becoming a defect of its own: it is only honoured at or after the playhead, so a landing line is never delayed; the playhead reaching it ends it; and a tick budget ends it regardless, so a boundary the harvest never closes costs 10 s of a window that runs a 60 s lead.

    Measured

    Fixture: a real PGS stream repeated every 26 s into a 400 s H.264 file, 80 authored sets, clears 3.5 s to 4 s after their set, driven through aetherctl play with the published window logged per cue and compared against ffprobe's packets.

    • 25 seeks in 50 s, three runs each. Before: 10, 12 and 10 sets carried an end that was not the authored one, worst case 110 s late, and 5 more per run stayed open forever. After: 0, 0 and 1, none open.
    • Burst of two (populate an island at 300 s, seek back to 231 s), then play through the region. Before: all three runs lost an authored set entirely and closed its predecessor 11.5 s late. After: all three delivered all 11 sets on their authored bounds.

    Both are in 6.23.1, together with a diagnostic answer to your last paragraph.

    On your note about sampling in the diagnostics

    Worth having asked. The per-cue [applySubtitleEvent] line is budgeted at 20 per SEEK generation rather than per load, which was itself the fix for a report where the silence after the twentieth event read as starvation. The per-tick delivery line emits on a change of class and on every reset tick, so a steady state prints once rather than at 2 Hz. Neither samples by position, which is the property your window diagnostic was missing.

    The one silent state this work did find is now named: a tick that stops at a hole in the harvest decodes nothing on purpose, and without a line of its own it read as outcome=empty, which says the store was never fed there when in fact it was fed on both sides. It now reads outcome=harvestHole gapAt=<seconds>, so if anything of this shape survives on your side, that line names the stretch and can be matched against the producer's own log.

    Retest when convenient, and the title still does not need naming unless you would rather it were matched against a copy here.

  2. rrgomes commented on Aug 13, 2026

    @rrgomes
    ContributorAuthor

    Retested on 6.25.1, up from 6.21.0. Our own host-side dwell cap came out
    first, in its own commit, so nothing on our side could mask the result.

    The original repro asset is clean. 1080p AVC, PGS, FLAC main plus an
    AC-3 commentary track: a seek burst through the dense region that used to
    produce wrong ends produced none, and nothing stayed open. 21
    harvestHole ticks in that session, all reporting
    packets=0 events=0 cues=0 — the class your release note says used to
    read empty. The new diagnostic is doing exactly what it claims.

    A different asset still shows both faces. 4K HEVC Dolby Vision
    Profile 7 (MEL, CMv4.x), ~86 Mbps, PGS, FLAC stereo — same loopback VOD
    path. Nine programmatic seeks in twelve seconds, covering 22 s to 242 s.
    Two sets came out of the drain with ends the source did not author:

    engine window source (ffprobe; 30-byte packets are the clears)
    set A 75.1 – 145.0 (69.9 s) set at 75.117, clear at 78.579
    set B 145.2 – 223.3 (78.1 s) set at 145.187, clear at 150.192

    Set A's end is a real clear — the one at 144.978, sixty-six seconds past
    the one that belongs to it. Set B's end is not a clear at all: 223.306 is
    the next set (16,148 bytes). Our mirror caught B being closed after the
    fact — it arrived as 145.2-open and was republished as 145.2-223.3
    a second and a half later.

    Neither raised harvestHole, which is the part that looks diagnostic
    to me. The hole check appears to guard delivery — every tick it names
    reports packets=0 events=0 cues=0 — while end-derivation walks the same
    store without it. If firstPTS(after:) returns the first PTS in the
    retained window with no test that the ground between the set and that PTS
    was ever retained, then whenever the store holds an island the "next
    clear" it finds is the first clear on the far side of the gap. The window
    census is consistent with that: spans through this burst read
    0.7..145.2, then 0.7..224.7, 0.7..231.3, 0.7..242.4 — a fixed low
    anchor and a jumping frontier.

    One cheap guard, if it is useful: a set's own clear is a few seconds away
    by construction, so an end sixty-six seconds out is prima facie not it.
    That is the same span sanity that motivated our host cap, applied to the
    derived end rather than to display.

    Happy to name the title and hand over the packet dump if you would rather
    match it against a copy on your side.

  3. superuser404notfound commented on Aug 14, 2026

    @superuser404notfound
    Owner

    The diagnosis in that retest is right, and the last paragraph is the one that pointed at it: the end derivation walked the same store with no test that the ground between the set and its answer had ever been read, and, less obviously, with no horizon at all. It could answer with a packet the drain was not even looking at. Both sets in the table are that.

    Two things were wrong, and only one of them is the answer itself.

    The answer was final

    firstPTS(after:) was the whole fix in 6.23.1, and its result was published as if it were authored, once. The close it feeds ran only over cues still carrying the open-ended placeholder, so the moment a set took any end short of that window it was never revisited. The clear that lands a second later, whose entire job is to trim that set, then finds a cue it is no longer allowed to touch, and nothing else is coming: the drain cursor moves forward only, so a packet filling a hole behind it is never decoded and its pgsTrimAt never runs.

    That is the permanence in the report, and it is what makes an island answer stick rather than pass. A bitmap set has no end of its own, so every stored packet after it is a bound on its end and taking the nearest is monotone. The derivation now runs on every drain tick and can only ever shorten. On a fixture trace the same set reads TRIM #8 -> end=113.00 (the island, 42 s late) and then, once the ground fills, TRIM #15 -> end=71.00, its authored clear. The second line cannot happen on 6.25.1.

    The answer was unbounded

    The suggested span sanity is the right instinct, and it is in, anchored on something the engine already knows rather than on a dwell constant. A PGS set can legitimately run a minute, so a threshold on how far the answer sits cannot separate an authored dwell from a hole. What can be decided is how far the harvest is designed to have reached: the forward prefetch parks a margin past the drain window precisely so that the set at the window's forward edge has its own clear stored, which was the other half of 6.23.1. Inside that horizon a stored packet is evidence the harvest was here and found this; beyond it the store holds whatever earlier runs left behind. The derivation stops there now.

    Against the two cases: the set at 145.187 answered at 223.306, which is 18 s past that window's edge, so it is withheld and the clear at 150.192 wins the race it was losing. The set at 75.117 answered at 144.978, which is 70 s out and still inside the horizon, so it is still taken, and then corrected by the paragraph above when the clear at 78.579 is stored.

    Why harvestHole stayed silent

    Worth the question, and the answer is a limit in the 6.23.1 mechanism rather than a missing call. Harvest ORDER can express one restart and not the other. A reader restarted BEHIND leaves an older island ahead of the new run, so a PTS-ascending pair whose sequence descends marks the boundary, which is what that check finds. A reader re-anchored FORWARD keeps appending in ascending order across the ground it skipped, and nothing about the packets that arrived can show what never did. On the fixture that reads as sequence 19, then sequence 20, with 46 s of unread source between them. So the check is one-sided, and the derivation was walking a store whose provenance could not answer it either way. Hence the horizon: only the drain knows how far the harvest should have got by now.

    There is a new counter for exactly the gap noticed here. A tick reports endsWithheld=N when it left bitmap cues open because the only answer lay past that horizon. harvestGapAt reports where DELIVERY stopped and says nothing about an end derived from the same store on a different horizon, which is why a window carrying a wrong end with no gapAt beside it read as nothing at all.

    On the missing sets

    This one did not reproduce here, and the mechanism argues it should not: the ground a forward re-anchor skips lies behind the playhead that caused it, the drain deliberately never waits on a hole behind the playhead, and any return to that ground is a seek, which restarts the pump there and fills it. Across three seek shapes on the fixture, every authored set in the stretch the playhead actually played was delivered (23/23, 15/15, 13/13), including one run whose store carried that 46 s gap at the time.

    One caution from measuring it, in case it applies on the other side too: a landing that a burst leaves after a second cannot deliver its region at all, and in a window census that is indistinguishable from a stretch that was lost. The counts here only became meaningful once they were restricted to the range the playhead actually traversed, and once the harness reported cues LEAVING the window. aetherctl had CUE and TRIM and nothing for a drop, so a wrong end that a later reconstruction replaced read exactly like one still carried, which cost two rounds of measurement here before it was noticed. It now prints DROP #id and a closing window census.

    So if there is still a stretch arriving short, the useful shape would be the authored set starts against the delivered ones for a range the playhead played through, rather than one it passed over during the burst. The title and the packet dump are welcome if that is easier; matching it against a copy here is no trouble.

    Measured

    400 s H.264 fixture with a real PGS stream repeated every 26 s, 80 authored sets, clears 3.5 to 4 s later, served through an origin with a 250 ms delay on every request. Loopback cannot show any of this: it refills an island before the island can matter, and every arm reads identical there. Three runs per arm of the recipe from the original report, scrub hard then land before a dense stretch and play through: 8 of 10 wrong ends corrected before, 9 of 10 after, 9 of 9 on the release build.

    Not fixed, and worth naming: for a region a session abandons, no signal in the engine can produce the authored end. The ground is never read, so the nearest stored packet stays the best bound available, and on the fixture that leaves ends up to +37 s in a burst that never returns. Refusing there is worse, not better: the cue stays open and the next seek launders it into the reconstruction boundary, 15 s behind the landing, which on that same cue works out at +46 s.

    Both are in 6.25.3. Thanks for the retest and for pulling the host-side dwell cap first, that is what made the result readable.

  4. rrgomes commented on Aug 15, 2026

    @rrgomes
    ContributorAuthor

    Retested on 6.25.4. Both faces are fixed on the asset that was still
    failing — the 4K HEVC Dolby Vision Profile 7 title, same nine-seek burst
    through the same region.

    The end that was not the author's. The set at 75.117 now publishes as
    75.1-78.6, which is its own clear at 78.579. On 6.25.1 the same set
    published as 75.1-145.0, taking the clear at 144.978 from the far side
    of the gap.

    The unbounded answer. The set at 145.187 publishes open and stays open
    at a playhead of 184.8 — so the 223.306 answer is being refused, which is
    the horizon bound doing exactly what you described. I want to check I have
    the intended reading: an open end that the next stored clear will shorten,
    rather than a wrong end that nothing could revisit. That is the better
    trade from here, and I ask only because the open window is the one state
    our own logs are least able to observe (below).

    Everything else in the burst is a few seconds and matches the source
    packet list. Where a clear exists it is used, and where the next packet is
    another set that set is the true successor. Census over the run: 96
    published, 39 harvestHole, 27 empty, 23 trimOnly, 2 held.

    One caveat on our field reports, which may be worth knowing. Our host
    drops its own bitmap mirror on every seek — a stale window used to re-pin
    the pre-seek display set, so the mirror is scoped to a seek generation.
    That means an open-ended cue on our side cannot hold the overlay across a
    seek even when it is genuinely open, and a user never sees it. So an
    absence of open-end symptoms in anything we report is partly our doing,
    not only yours. The 145.2-open above surfaced only because we log the
    engine's window as received, before any of our own clamping.

    Thanks for turning this around overnight, and for the writeup — the
    distinction between an answer that is merely bounded and one that is
    self-correcting is the part I had not seen.

  5. superuser404notfound commented on Aug 15, 2026

    @superuser404notfound
    Owner

    Confirmed, that is the intended reading. It is worth being exact about which of the two mechanisms that set is sitting in at 184.8, because it is the better of them and it reads the same from outside.

    The reading

    For a bitmap set the end is a bound, never a verdict. alignCueEnds re-derives it on every drain tick, over the whole retained array rather than the tick's own cues, and it can only ever shorten. The placeholder is simply the longest end there is, so an open cue is not a state of its own: it is the same rule with nothing stored to answer it yet, and the first packet the store gains after the set replaces it. That is the whole of round 2. On 6.25.1 the derivation spent the cue's one chance the first time it answered, and the clear that lands a second later, whose entire job is to trim that set, found a cue it was no longer allowed to touch.

    Reproduced here on a fixture built to your geometry (dense sets to 153.5, then no subtitle packet at all until 223.3, served through an origin with 250 ms on every request). A landing at 137 whose store held only the island from 223.3 onward:

    playhead=137.30 packets=4 events=4 cues=2 admitted=2 published=2 outcome=published endsWithheld=12
      CUE #11 140.00-4295107.29 [bitmap]
      CUE #13 145.00-4295112.29 [bitmap]
      TRIM #11 -> end=144.00
      TRIM #13 -> end=149.00
    

    Both sets published open with the island as the only stored answer, both were refused it, and both took their own authored clears a second later, when the harvest reached them.

    Which mechanism the set at 145.187 is in

    The horizon is not fixed when the cue publishes, it travels with the playhead: the drain window is playhead + 60 s and the horizon is that plus the forward prefetch's park margin, 15 s. At a playhead of 184.8 it stands at 259.8, so 223.306 is inside it, and inside the drain window (244.8) as well, where the packet would be decoded and would trim the cue through its own pgsTrimAt. Every PGS composition broadcasts its start as a trim, sets included, which is how a packet that is not a clear can end its predecessor.

    So the cue is not open there because its answer is being refused. On the mechanism there is only one reading left: the store held nothing after 145.187 at that moment, the harvest not having walked from its restart point out to 223.306 yet, which on an 86 Mbps stream is a lot of source to read for one subtitle packet. The refusal happened earlier, during the burst, at a playhead near 145 where 223.306 sat 78 s out and the island was already stored. That instant is exactly the one 6.25.1 stamped.

    The tick line does separate the two, which is worth knowing for the next report: endsWithheld=N present means a stored answer was refused for lying past the horizon, and its absence beside outcome=empty means there was nothing there to refuse.

    What to expect on that cue

    It closes at the first packet the harvest stores after it. If the session never returns to the ground at 150.192, that packet is the set at 223.306, so the bound rather than the authored end. That is the residue named in the notes and it is unchanged: for ground a session abandons, no signal in the engine can produce the authored clear, because the clear is never read. What did change is that the bound stays revisable, so a seek back into that stretch trims it to 150.192, and any nearer packet wins at any point while the cue is retained.

    Withholding is therefore a "not yet" and never a "never". It buys the race rather than the refusal: a set's own clear is a few seconds away by construction and the far side of a hole is tens of seconds away, so delaying the answer by the width of the horizon is enough for the near one to win wherever the ground is being read at all.

    On your mirror

    That is worth knowing and it cuts both ways, so thank you for naming it. The placeholder end the engine publishes is the format's own, end_display_time = UINT32_MAX, which lands about 49.7 days past the start (the 4295112.29 in the trace above), and anything more than an hour out is what the engine reads back as unconfirmed. So a host that renders the active cue with no cap of its own carries an open bitmap set until something closes it. The engine's own bound on that is the reset close from #357, which retires an unconfirmed end at the reconstruction window when a seek jumps past the cue, and nothing at all while the playhead simply plays on. A seek-scoped mirror hides both the state and its resolution, which is why the one place 145.2-open surfaced for you was the window as received.

    Leaving this open rather than closing it, in case the region above turns up anything on a pass that plays through it. Happy to close it whenever you are.

  6. rrgomes commented on Aug 17, 2026

    @rrgomes
    ContributorAuthor

    Ran the play-through pass on the region, on 6.26.0. Same 4K HEVC Dolby Vision Profile 7 title: a 144-seek storm across the 19–194 s region over about five minutes with subtitles on, then normal playback on through the stretch the earlier burst had abandoned.

    Nothing user-visible — no held set, no flash-through, nothing pinned. The instruments agree with the screen:

    • The set at 145.187 published open and took its own authored clear on the next drain tick: the window as received read 145.2-open for about half a second, then 145.2-150.2, the ground at 150.192 having been read on this pass. Every set in the storm shows the same transient open→trim shape.
    • endsWithheld= was present on 168 delivery ticks — far-side answers refused for the horizon while the near ones won, which matches the intended reading exactly.
    • No starvation across the storm: 159 outcome=published ticks with seekGen reaching 141; the harvestHole/empty ticks were all transient.

    Happy for this to close. Thanks for the endsWithheld discriminator — it turned this pass into a ten-minute read.

  7. superuser404notfound commented on Aug 17, 2026

    @superuser404notfound
    Owner

    Closing on that, thank you.

    The play-through is the pass the earlier rounds could not produce, and it lands the residue exactly where the design left it: with the ground at 150.192 read on this pass, the authored clear wins, and the transient 145.2-open then 145.2-150.2 is the whole mechanism visible from outside. An end that stays revisable looks like nothing at all when the harvest is keeping up, which is the intended shape.

    The two numbers worth keeping from that run: 168 ticks carrying endsWithheld= against zero user-visible holds is the horizon doing what it was built for, spending its refusals on far-side answers while the near ones arrive. And 159 outcome=published ticks with seekGen at 141 says delivery held through a 144-seek storm, which is a harder run than the one that opened this.

    endsWithheld stays in the tick line for the same reason it earned its place here: open because a stored answer was refused and open because nothing is stored yet are different states, and nothing else in the log separates them.

    Thanks for three rounds of detail on both faces, and for naming the mirror cap in the first report. Capping the dwell host-side is the right call regardless of what the engine does, since an unconfirmed end is a bound and no host can tell it from an authored one by the time it arrives.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions