Repository navigation
fix(disc): defeat repeated-clip decoy playlists in BD title selection (#105) - #108
Merged
Merged
Conversation
…#105) Anti-rip Blu-rays (e.g. TRON: Legacy 4K) pad PLAYLIST with a decoy .mpls that references one short menu/loop clip hundreds of times, inflating its declared duration to 5+ hours while the demuxer only ever probes the first clip's ~76s of PTS. BDTitleSelector ranked titles purely by durationTicks, so the decoy (5:23:17) crowned the real 2:05 feature as the main/default title. Scrubbing or snapshotting past 76s then seeked past the demuxer's EOF and decoded a blank garbage frame that still reported image=ok, which surfaced as issue #105 (blank generated snapshot). - BDTitleSelector: isRepeatedClipDecoy flags a playlist dominated by one repeated clip (repeats past a floor and supplying >half its PlayItems); selectMainTitle and enumerateTitles drop decoys before the duration-max sort, with the existing never-leave-zero-titles fallback. Light legitimate clip reuse (seamless branching, multi-angle) is preserved. - FrameDecodeContext: clampSeekSeconds clamps a still requested past the demuxer's known duration to the last decodable frame instead of seeking past EOF into a blank frame (defense-in-depth behind the selector fix). Both the seek and the snapshot forward-decode target use the clamped value. Tests: BDTitleSelectorTests covers decoy demotion, the only-decoy fallback, and light clip-reuse tolerance; FrameDecodeContextClampTests covers the pure clamp arithmetic. 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
Issue #105: the generated snapshot is a blank image. Reporter's log + screenshots show a Blu-ray ISO (TRON: Legacy 4K, 16 titles):
The disc's longest-duration
.mplsreferences one ~76s menu/loop clip (00038) 252 times, inflating its declared duration to 5:23:17 while the demuxer only ever probes the first clip's PTS (76.64s).BDTitleSelectorranked titles purely bydurationTicks, so this decoy crowned the real 2:05 feature (single clip00070) as the main/default title. Scrubbing or snapshotting past 76s then seeked past the demuxer's EOF and decoded a blank garbage frame that still reportedimage=ok.This is not the tone-map path and not the #106 single-connection second-demuxer class.
Fix
BDTitleSelector:isRepeatedClipDecoyflags a playlist dominated by one repeated clip (repeats past a floor and supplying more than half its PlayItems).selectMainTitleandenumerateTitlesdrop decoys before the duration-max sort, keeping the existing never-leave-zero-titles fallback. Light legitimate clip reuse (seamless branching, multi-angle) is preserved.FrameDecodeContext:clampSeekSecondsclamps a still requested past the demuxer's known duration to the last decodable frame instead of seeking past EOF into a blank frame (defense-in-depth behind the selector fix). Both the seek and the snapshot forward-decode target use the clamped value.Tests
BDTitleSelectorTests: decoy demotion (real feature becomes the main title), only-decoy fallback, light clip-reuse tolerance.FrameDecodeContextClampTests: the pure clamp arithmetic (in-range passthrough, past-EOF clamp, unknown-duration passthrough, end-scrub tolerance).Verification
swift build -Xswiftc -strict-concurrency=complete: cleanxcodebuild -scheme AetherEngine): BUILD SUCCEEDED🤖 Generated with Claude Code
https://claude.ai/code/session_01HFZVoTDayyEfpqrY8ohNyg