Repository navigation
Use video contiguity as the anchor signal, drop the cross-level consecutive rule - #10
Merged
littlespex merged 1 commit intoOct 13, 2026
Conversation
…evel rule Review on video-dev#8083: the sequence-number leg assumed aligned numbering across variants, and across a level switch timeOffset is only as good as the playlist alignment, so binding the first PTS to it would turn drift into an overlap or a gap. Same-level discontinuities have an exact start from updateFromToPTS. isVideoContiguous is cleared by resetNextTimestamp exactly when the transmuxer reports a non-contiguous fragment and set when video was remuxed, so it is "contiguous, with previous video to continue from". Remove the consecutive field of TransmuxState, the second argument of Remuxer.resetTimeStamp and the presentation-time rule. A discontinuity that coincides with a level switch keeps the DTS anchor. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
littlespex
marked this pull request as ready for review
October 13, 2026 23:46
littlespex
merged commit Oct 13, 2026
10c8f33
into
fix/discontinuity-initpts-anchor-8064
9 of 10 checks passed
littlespex
deleted the
fix/discontinuity-initpts-anchor-8064-contiguous
branch
October 13, 2026 23:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR will...
Answer Rob's review on video-dev#8083 by using
contiguousas the signal for the PTS anchor, through the remuxer's ownisVideoContiguous, and dropping the cross-levelconsecutiverule. Base is the upstream PR branch, so the diff here is only the simplification. Against upstream master the source change is three lines ingenerateIS.Removed: the
consecutivefield ofTransmuxState, the second argument ofRemuxer.resetTimeStamp, the presentation-time rule for level switches, and the transmuxer specs that pinned them. Kept: the four remuxer anchoring specs; the level-switch spec now asserts the DTS fallback, that is one composition offset once at a discontinuity that coincides with a switch.Why is this Pull Request needed?
Rob's two points hold. The sequence-number leg assumed aligned numbering across variants. Across a switch,
timeOffsetis only as good asalignStream's playlist alignment (it lines up the latest shared discontinuity and lets earlier boundaries fall out of the new playlist's durations), so binding the first PTS to it would turn drift into an overlap or a gap. Same-level discontinuities get an exact start fromupdateFromToPTS.Are there any points in the code the reviewer needs to double check?
isVideoContiguousrather than acontiguousparameter onresetTimeStamp:resetNextTimestamp, which the transmuxer calls exactly whencontiguousis false, and set when video was actually remuxed. So it reads as "contiguous, with previous video to continue from": an audio-only or failed previous fragment falls back to DTS.remuxVideoalready uses for hole and overlap repair, so anchoring and stitching agree.resetInitialTimestampbeforeresetContiguitybeforeremux. The explicit alternative isresetInitialTimestamp(defaultInitPts, contiguous)andremuxer.resetTimeStamp(defaultInitPts, contiguous), four lines, if that reads better.timeOffset !== 0(Rob's suggestion in the second review comment) was built and run in the same harness. On the deltatre stream it gives the same result asisVideoContiguous. In the video-dev#7932 scenario (startPosition: 28.8, pinned level, seek to 0) it anchors the first segment on PTS (initPTS 0.087 instead of 0.020); sn 1 then appends audio at [0, 9.995] but no video andreadyStatestays 1. With a pinned level there is no track switch, so the video-dev#7700 re-anchor ingenerateISnever runs, and that is the case 1.6.18 fixed.isVideoContiguousleaves starts and seeks on the DTS anchor.Testing
1210 unit tests pass,
tscand eslint clean. The deltatre, video-dev#7932 and video-dev#7977 browser checks were run on the first commit's build, which had this exact source change.Resolves issues:
Follow-up to #9 for video-dev#8083. After review: fast-forward
fix/discontinuity-initpts-anchor-8064to this commit, which updates the upstream PR, then reply to Rob in the thread.🤖 Generated with Claude Code