Skip to content

PGS: 5.23.11 side-reader park (#230) regresses the 5.15.2 #143 shape — a seek landing whose only later display set is beyond the 60 s lead is never shown again (bisected: 5.23.10 good, 5.23.11 dark) #234

Closed

Description

@cmcpherson274

What happened?

A PGS line that should be on screen at the seek destination is never shown when the line's own
zero-object CLEAR is the only display set after it and that clear sits beyond the 60 s lead
window. This is the exact shape you fixed in 5.15.2 for #143 ("a landing whose clear sits beyond
the 60 s lead: now paints") — it held from 5.15.2 through 5.23.10 and goes dark again in 5.23.11.

Fixture (synthetic, attached, authored-truth JSON included): PGS track with a show at 200.0 s,
its clear at 280.0 s (an 80 s line — nothing else stored between them), on a ~660 s file.
Seek to 210 s, i.e. land inside the line.

  • 5.23.10 (b6724e4) and every release back through 5.15.2: the landing display set is decoded
    and applied after the seek, and the line publishes with end == 280 exactly.
  • 5.23.11 (ad5497c): the landing display set is never delivered — no apply event, nothing ever
    publishes at the destination. Deterministic, 3/3 runs.

Same machine, same day, same fixture bytes (sha256 13236b19…), same invocation for every leg;
only the engine revision differs. Bisected across 5.20.7 → 5.23.9 → 5.23.10 → 5.23.11: the break
lands exactly on 5.23.11, whose only subtitle-path change is the #230 side-reader park rework.

Log signature, post-seek forward prefetch on the same seek:

5.23.10: #151 forward prefetch started: streams=[1] startAt=210.40s lead=60.0s
#151 forward prefetch exited (cancelled=true) harvested=3
[applySubtitleEvent #2] cueStart=200.000s cueEnd=4295167.295s currentTime=210.4s

5.23.11: #151 forward prefetch started: streams=[1] pacing=0 startAt=210.30s lead=60.0s
#151 forward prefetch exited (reason=cancelled cancelled=true) harvested=1
(no applySubtitleEvent for the 200 s landing — it never arrives)

A hypothesis, offered loosely since you know this code and we don't: before #230 the reader ran
past the lead edge, which incidentally delivered both the landing set behind the seek point and
its far clear; with the park now paced by the NONKEY stream's DTS and held at the lead edge, the
landing display set at 200 s (behind the 210 s seek, its only successor 80 s ahead) seems to be
the packet that no longer gets delivered — harvested drops 3 → 1 on the same bytes. The
regression is upstream of the #143 finalize: the landing is never decoded at all, so the
finalize never gets its chance.

Happy to re-run any variant (different gaps, different seek offsets) if useful.

Steps to reproduce

  1. Use the attached b0-clearshape.mkv (synthetic PGS authored by our fixture tool; the attached
    .sidecar.json is its authored truth). The relevant events: show at 200.0 s, zero-object clear
    at 280.0 s, nothing between; next show at 598.0 s.
  2. Open it on the native path with the PGS track selected (stream index 1, hdmv_pgs_subtitle).
  3. Seek to 210.0 s and wait ~20 s.
  4. Expected (5.15.2 … 5.23.10): the 200 s line is shown at the destination and publishes with
    end 280. Actual (5.23.11): nothing is ever shown at the destination.

AetherEngine version or commit SHA

5.23.11 (ad5497c). Last good: 5.23.10 (b6724e4). Also verified good same-day on the same fixture bytes: 5.23.9, 5.20.7.

Host app

Custom / my own integration

Platform

macOS

OS version

macOS 26.5.2

Device / chip

Mac Studio (Apple silicon, arm64)

Playback path

Native AVPlayer

Source media (for playback bugs)

Attached: b0-clearshape.mkv — 8.8 MB synthetic MKV (320x180 video + one PGS track authored by
our PGS fixture tool; no commercial content). b0-clearshape.sup.sidecar.json is the authored
truth (display-set list with PTS + composition hashes).

Error codes / log lines

No error is raised anywhere — the landing simply never arrives. Side-by-side on the same seek:

5.23.10 (good):
[AetherEngine] #151 forward prefetch started: streams=[1] startAt=210.40s lead=60.0s
[AetherEngine] #151 forward prefetch exited (cancelled=true) harvested=3
[applySubtitleEvent #2] cueStart=200.000s cueEnd=4295167.295s engine.currentTime=210.400s

5.23.11 (bad):
[AetherEngine] #151 forward prefetch started: streams=[1] pacing=0 startAt=210.30s lead=60.0s
[AetherEngine] #151 forward prefetch exited (reason=cancelled cancelled=true) harvested=1
(no applySubtitleEvent for cueStart=200)

Anything else

Activity

  1. added
    bug
    on Jul 27, 2026
  2. added a commit that references this issue on Jul 28, 2026
  3. superuser404notfound commented on Jul 28, 2026

    @superuser404notfound
    Owner

    Thanks for this one. A bisection across four releases on identical fixture bytes, with the harvested counts on both legs, pointed straight at the cause, and the authored-truth sidecar made it reproducible here without guesswork.

    The park is not the problem, but it is the change that exposed it. The regression is in the positioning.

    The prefetcher positions with avformat_seek_file(ctx, -1, ...). A -1 stream index means libavformat picks the reference stream itself, in av_find_default_stream_index, and that score awards +200 to any stream with discard != AVDISCARD_ALL:

    if (st->discard != AVDISCARD_ALL)
        score += 200;

    Until 5.23.10 every non-subtitle stream sat at AVDISCARD_ALL, so the subtitle stream was the only one collecting that +200 and won the vote 200 to 75. The seek was measured on the subtitle axis and landed on the last display set at or before the target, which is the landing set. #230 moved the pacing stream to AVDISCARD_NONKEY, which is not AVDISCARD_ALL, so video collects the same +200 and wins at 275. The seek now lands on the last video keyframe instead.

    On Matroska that is decisive: matroska_read_seek jumps to the cluster byte position named by the reference stream's index entry, and anything in earlier clusters is never read. A landing set 10 s behind the destination is therefore behind the read head before the first packet is delivered, which is why harvested drops to the single 280 s clear and why nothing publishes. The #143 seed and the #204 finalize never get their chance, exactly as diagnosed.

    One thing worth knowing for future fixtures: this class does not reproduce on MP4. mov_read_seek re-seeks every stream individually and backwards, so a sparse subtitle track keeps its landing sample whatever the reference stream is. The #230 tests ran on an MP4 fixture, which is how they stayed green on a broken build.

    Fixed on main in 59530f8 (merged as f1c09cc). The anchor is now passed explicitly and the target is converted into that stream's own time base, so positioning no longer depends on which streams happen to be deliverable. The #230 park itself is unchanged. Regression coverage lives in Issue234SideReaderSeekAnchorTests on a small purpose-built Matroska fixture carrying the reported shape at fixture scale (landing at 3 s running to 11 s, successor at 12 s, seek to 7.5 s): without the anchor the landing never reaches the store, with it both cues do. The #151 forward prefetch started line now also carries anchor=<index> next to pacing=, so the axis a session positioned on is readable straight from the log.

    A release follows shortly. Leaving this open for the retest.

  4. cmcpherson274 commented on Jul 28, 2026

    @cmcpherson274
    Author

    Retested at 5.25.2 (cf164d8) on the same fixture bytes and invocation as the report: fixed.

    The landing publishes at the destination on every run, with END equal to the authored clear PTS
    exactly:

    b0clear-210 (show 200.0 / clear 280.0, seek to 210): published, end=280, 3/3 runs
    (5.23.11 on these same bytes: nothing published, 3/3)

    The new anchor= field makes it readable straight from the log, exactly as you said — stream 1 is
    the PGS track here:

    5.23.11: #151 forward prefetch started: streams=[1] pacing=0 startAt=210.30s lead=60.0s
    -> harvested=1, no applySubtitleEvent for the 200 s landing

    5.25.2: #151 forward prefetch started: streams=[1] pacing=0 anchor=1 startAt=210.30s lead=60.0s
    -> [applySubtitleEvent #2] cueStart=200.000s cueEnd=4295167.295s currentTime=210.900s

    No regression anywhere else in the battery: the four shapes from the #143/#204 family (clear
    within the lead, forced landing, EOF landing, no-clear landing) and the second control all still
    publish with ends exact at 5.25.2.

    Two notes of thanks rather than business:

    Our stated mechanism was wrong and yours is obviously right — we blamed the park for withholding
    the packet, when the packet was positioned past. The av_find_default_stream_index +200 detail
    (subtitle winning 200-75 until the pacing stream made it 275) explains the harvested 3 -> 1 drop
    exactly, and it is not something we would have found from the outside.

    The MP4-vs-Matroska point is the most useful thing we have read in a while, and we have written it
    into our own fixture guidance: mov_read_seek re-seeking every stream individually means an MP4
    suite simply cannot see this class, so seek-positioning coverage has to be Matroska. That is why
    this only surfaced against a Matroska battery.

    Good to close from our side.

  5. superuser404notfound commented on Jul 28, 2026

    @superuser404notfound
    Owner

    Retest noted, closing it here. Thank you for the bisection: four releases on identical fixture bytes with the harvested counts on both legs left exactly one candidate, and the authored-truth sidecar meant the landing set could be checked against the file rather than against a reading of the render. That is what turned this into a same-day root cause instead of a week of instrumentation.

    Two notes on ground that moved since the report.

    runNativeSubtitleReaders carried the same missing anchor, but not as a regression. There the seekBounded runs before discardAllStreamsExcept, so at seek time every stream is still at DEFAULT, all of them collect the +200, and video wins on its own +75. There was never an accidental subtitle anchor for #230 to take away; that path has behaved this way since the readers existed. Fixed in 9367748 and shipped in the same 5.25.2 you tested, so both readers now pass the anchor explicitly and log it.

    One residual worth knowing if you keep extending the Matroska battery: on a source whose subtitle track carries no cue points, the anchored seek falls out of matroska_read_seek into seek_frame_generic and scans forward from data_offset. The seek budget and the byte estimate bound it, so it is not unbounded, but on the native reader path that is new behavior (the prefetcher has run that way since 5.9.7). If a native reader ever takes an odd amount of time to start on an exotic MKV, that is the first place to look.

    The container point went into the changelog entry for the same reason you wrote it into your fixture guidance: an MP4 suite cannot see this class at all, so seek positioning coverage has to be Matroska. #230 stayed green on a broken build precisely there.

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