Repository navigation
fix(subtitles): preserve source axis for rebuilt VOD runs - #533
Conversation
… keeps its own (PR #533) PR #533 is right and measured, and it arrived as a SECOND dictionary next to `epochShiftByIndex`: same key, same call site, same lock, same pruning rule, and nothing anywhere to make the two agree. Folded into one `EpochAxisTable` whose entry states both quantities, with the pruning rule written once and the two questions named for what they answer: `opening(at:)` is AE#448's "does an epoch begin here", `sourceAxis(at:)` is #533's "what do the bytes holding this index map item time back onto the source with". The measurement the pair comes from, same bytes, one remuxed with `-output_ts_offset 600`, resuming at 53 s on both: zero origin actual=43000 desired=52000 pinnedTo=43000 shift=0 presentedShift=-9000 600 s origin actual=643000 desired=52000 pinnedTo=43000 shift=600000 presentedShift=591000 One gate, one backoff of 9 s, two numbers 600 s apart. That is also why the AE#412 re-cut line printed "opened 591.000s below its boundary" for a gate that opened 9 s below it: the shift carries the source origin, the backoff is the difference, and the difference is what that line meant. Second follow-up: the placement now carries its own normalization instead of the reading looking it up again. A backward restart between a composition and its reading drops that epoch's entry (that is the pruning rule working), and the late lookup would then answer with an older run's number. The composition already knows what it composed; nothing about it should be re-derived from a table that has moved on. Verified against both arms after the rewrite, `--start-position 53 --seek-count 5 --seek-pattern 65,60,70,58,75` over `Scripts/slowrange.py` at 600 kbps / 300 ms: 600 s origin landing publishes 600.000s, VERDICT OK, every capErr tick within one frame of -600.000 zero origin landing publishes 0.000s, capErr mean +0.000 over the 25 ticks after it, identical to main before PR #533 Both test runners green (2951 swift-testing, 631 XCTest, 0 failures). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VDKAJrLjLXVsCvJVNdJEPw
5487b02
into
superuser404notfound:main
|
Merged as Reproduced here on macOS before touching the branch, on So on that class of source it is not only the PGS query that misses: the published position goes The gate-open pair states the whole thing in two lines, same bytes, same resume at 53 s: One gate, one backoff of 9 s, two numbers 600 s apart. Two follow-ups on top, in
The AE#412 re-cut log line was reading from the same conflation and is fixed with it: it printed |
…533 round 2, AE#534) The axis this session publishes is two quantities added together: how far AVPlayer's own timeline sits from the playlist, and the source-to-item normalization the bytes carry. Every AE#418 rule is about the first one, and rounds 2 to 9 were measured on fixtures whose timestamps start at zero, where the two are one number. So the composition added the whole shift, which on any other source adds the source origin again per placement. Measured on `tc-cues-lie.mkv` remuxed with `-output_ts_offset 600` over `Scripts/slowrange.py` at 600 kbps / 300 ms, resuming at 73 s (seg18 re-aims 0.375 s) and seeking once: before #418 seg17 placed ... axis shift 599.625s -> 1196.458s from item -531.625s after #418 seg13 placed ... axis shift 599.625s -> 590.625s from item 81.000s (the reading then lands on 591.000s, which is what the picture reads) 1196.458 is the source origin counted twice, and the seam it wrote is 531 s below the start of a 120 s item. It self-corrects wherever the placement can be read back; AE#418 round 7 is the case where it cannot, and there it stands for the session. The composition now works in displacement and the normalization is added once, by the epoch that wrote the bytes. Consequences, all of them measured: - A placement's worth is its epoch's `openingSourceAxis` on either kind of reading, so PR #533's own-run / rebuilt branch collapses: the two disagree about the BASE, which is measured, not about what the bytes are worth. An AE#412 re-cut is worth nothing to the displacement and its normalization to the axis, which is one statement in the new terms and was two in the old ones. - `placementBase`, `placementOffset` (was `axisShift`) and `placementDisplacement` are the same arithmetic with honest labels: they always described the displacement. Every pinned number in their tests is unchanged, which is the point. - `publishPlaylistShift` now takes the displacement the axis is made of, so a call site cannot publish one without saying what the other half was. `snapAxisAfterSeek` is deliberately NOT moved onto the displacement, and it keeps asking about the axis, which means it stays inert on a source whose timestamps do not start at zero. Measured on both twins: on the one arm that separates the two (a seek into content AVPlayer already holds) inert is the RIGHT answer, because AVPlayer keeps the displacement there and the rule discards it anyway, costing the zero-origin twin 0.400 s of cue accuracy for the rest of the session. That is AE#534, with both arms. Zero-origin behaviour is unchanged everywhere, byte for byte across three runs per arm: the #481 arm publishes -9.000 then 0.000 with a capErr mean of +0.000, and the two-seek arm publishes -0.375, 0.000, -9.000 with capErr +0.075, 3 of 3. Both test runners green (2953 swift-testing, 631 XCTest, 0 failures). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VDKAJrLjLXVsCvJVNdJEPw
|
Released in 6.85.0 ( One more thing came out of the same lens after the merge, so it is in that release too. The composition had the same conflation the landing rule had: it added the whole shift per placement rather than what the gate backed off, so on the 600 s twin a placement worth 596.833 s composed onto a standing 599.625 s and published 1196.458 s, with the seam at item -531.625 s. It self-corrects wherever the placement can be read back out of AVPlayer's buffer, which is why the arm here recovered within a tick; AE#418 round 7 is the case where it cannot, and there it would stand for the session. The composition now works in AVPlayer's own displacement and the normalization is added once, by the epoch that wrote the bytes: That also collapsed the own-run / rebuilt branch this PR introduced: once the composition is in displacement terms, a placement's bytes are worth the same on either timeline, and what the two disagree about is the base, which is measured. The offset-origin fixture recipe is worth having if more of this comes up: |
Summary
Preserve the source-to-item timestamp normalization carried by rebuilt loopback-HLS VOD runs. Without it, raw-source-PTS subtitle formats such as PGS can be queried hundreds of seconds away from the visible playhead after a cached landing or recut.
What changed
Test plan
Checklist