Skip to content

fix(disc): rebase multi-clip Blu-ray playhead onto the 0-based display axis (#105) - #111

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/bd-presentation-origin
Jul 7, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/bd-presentation-origin

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

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 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 (currentShiftSeconds = playlistShiftSeconds + subtitleStreamStartSeconds), so the source-PTS currentTime was 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 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 / 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.
  • Full suite 437 pass, XCTest disc suite 30 pass, -strict-concurrency=complete clean, tvOS-Sim + iOS-Sim BUILD SUCCEEDED.

🤖 Generated with Claude Code

…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
@superuser404notfound
superuser404notfound merged commit 83cffa7 into main Jul 7, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the fix/bd-presentation-origin branch July 7, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant