Repository navigation
fix(disc): rebase multi-clip Blu-ray playhead onto the 0-based display axis (#105) - #111
Merged
Merged
Conversation
…y axis (#105) Round 4 (95aef3a) made the multi-clip fold contiguous, but the reporter still saw the playhead sitting far past the total on the short TRON titles (10:04 on a 0:35 title, 1:10:14 on a 0:41 title, ball pinned at the end). That was never the fold: a disc title publishes its duration from the 0-based MPLS/IFO playlist, while the engine kept publishing currentTime on the source-PTS axis, which for a disc starts at clip 0's STC base (599s / 4199s). Position and total lived in different domains, so the playhead overshot the bar and seek clamped to a negative clock. The producer already anchors startPosition on the 0-based playlist axis (segmentIndexForPlaylistTime) and the subtitle reader already expects a 0-based resume offset, so the source-PTS currentTime was also feeding reload/resume the wrong domain. Introduce sourcePresentationOrigin: the source PTS that maps to display-0. It is 0 for normal files and live (their public axis already equals source PTS) and clip 0's STC base for a disc title (captured from the constant VOD shift in onPlaylistShiftChanged). PresentationAxis.display/source convert the published playhead, seek target, buffered frontier and seek input by that origin, so the scrubber, total, seek and resume all sit on the same 0-based axis as the duration. sourceTime and the internal producer/subtitle axes stay on source PTS for cue alignment. Off disc the origin is 0, so every conversion is a no-op and normal/live playback is byte-identical. Tests: Issue105PresentationAxisTests (+7) reproduce the reporter's 604s/4214s playheads rebasing to 4.083s/14.083s, the seek target landing on a 0-based playlist clock instead of a negative one, the zero-origin identity for normal VOD, and the display/source round trip. Full suite 437 pass, XCTest disc suite 30 pass, -strict-concurrency=complete clean, tvOS-Sim + iOS-Sim BUILD SUCCEEDED. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HFZVoTDayyEfpqrY8ohNyg
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.
Problem
Round 4 (
95aef3a) made the multi-clip fold contiguous, but the reporter still saw the playhead sitting far past the total on the short TRON titles: 10:04 on a 0:35 title, 1:10:14 on a 0:41 title, ball pinned at the end.That was never the fold. A disc title publishes its
durationfrom the 0-based MPLS/IFO playlist, while the engine kept publishingcurrentTimeon the source-PTS axis, which for a disc starts at clip 0's STC base (599s / 4199s). Position and total lived in different domains, so the playhead overshot the bar and seek clamped to a negative clock.The producer already anchors
startPositionon the 0-based playlist axis (segmentIndexForPlaylistTime) and the subtitle reader already expects a 0-based resume offset (currentShiftSeconds = playlistShiftSeconds + subtitleStreamStartSeconds), so the source-PTScurrentTimewas also feeding reload/resume the wrong domain (audio-switch/recovery reload resumed offset by base0; subtitle reload doubled base0 into its shift).Fix
Introduce
sourcePresentationOrigin: the source PTS that maps to display-0. It is 0 for normal files and live (their public axis already equals source PTS) and clip 0's STC base for a disc title (captured from the constant VOD shift inonPlaylistShiftChanged).PresentationAxis.display/sourceconvert the published playhead, seek target, buffered frontier and seek input by that origin, so the scrubber, total, seek and resume all sit on the same 0-based axis as the duration.sourceTimeand the internal producer/subtitle axes stay on source PTS for cue alignment. Off disc the origin is 0, so every conversion is a no-op and normal/live playback is byte-identical.Tests / gates
Issue105PresentationAxisTests(+7): reporter's 604s/4214s playheads rebasing to 4.083s/14.083s, seek target landing on a 0-based playlist clock instead of a negative one, zero-origin identity for normal VOD, display/source round trip.-strict-concurrency=completeclean, tvOS-Sim + iOS-Sim BUILD SUCCEEDED.🤖 Generated with Claude Code