Repository navigation
fix(disc): a DVD title declares its subpicture streams and probes briefly (AE#651) - #652
Merged
Merged
Conversation
…efly (AE#651) mpegps sets AVFMTCTX_NOHEADER and never clears it, so find_stream_info never takes its "all info found" exit and every DVD open read the full playback budget (50 MB / 60 s). The window existed to discover streams that start late, and it still missed any subtitle whose first packet came after it. The VTS IFO already declares the title's subpicture streams. They are now created before the probe; mpegps routes packets to an existing stream by id. libavformat attaches its dvdsub parser only to streams the demuxer created (need_parsing is internal), so DVDSubpictureAssembler joins the PES fragments in readPacketLocked under the parser's rule and is reset at every flush. A title with a readable IFO then probes 8 MB / 5 s; a disc without one keeps the old budget. Measured with aetherctl on an authored DVD over a 20 Mbit/s, 100 ms origin: first frame at 6.5 s instead of 29.6 s, 0.5 s after a prewarm. A subtitle first shown at 100 s is a track from the first frame and its 8 KB, multi-packet unit decodes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mf4MXgM9bqugHoe5TW4BYf
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.
Refs #651.
Problem
mpegpssetsAVFMTCTX_NOHEADERand never clears it, soavformat_find_stream_infonever takes its "All info found" exit. Every DVD open therefore read the full playback budget (probesize50 MB,max_analyze_duration60 s). That window exists to discover streams that start late, and it still missed any subtitle whose first packet arrived after it.Change
DVDIFOParser.parseSubpictureStreamIDsreturns every subpicture substream id the VTS IFO declares, with or without a language, using the same PGC control reading as the language parser. It returnsnilfor an unreadable IFO, which is a different answer from a title with no subpictures. The result is carried asDiscTitle.dvdSubpictureStreamIDs.Demuxercreates those streams right afteravformat_open_input.mpegpslooks a packet's stream up byAVStream.idbefore creating one, so their packets land there.dvdsubparser only to streams the demuxer created itself (need_parsingis internal). Without the parser, a subpicture larger than one pack reaches the decoder as its first fragment and does not decode (measured,outcome=undecodable).DVDSubpictureAssemblerjoins the fragments inreadPacketLockedusing the rule fromdvdsub_parser.c: the size comes from the first 16 bits, or from the 32 bits after a zero; the unit keeps the first fragment's timing; an overrun drops the unit. The assembler is reset at everyavformat_flush..mpg/.vobURLs, keep the old budget.Side effect: on such a title the declared subpicture streams come first in the stream indices. The forward prefetcher and the side readers now see these streams from the open (with
skipStreamInfothey used to see none). In the measurement below the prefetcher delivered the first cue at playhead 5.3 s instead of 16.6 s.Measured
aetherctlagainst dvdauthor-built DVD ISOs, served by a logging range origin at 20 Mbit/s with 100 ms per response:--prewarm(with #647)Subtitle discovery, on a disc whose IFO declares
en(first packet at 20 s) andde(first packet at 100 s, an 8 KB unit spread over several packets):en.--subs deproducesCUE #0 100.53(published).enunit decodes the same cue as on main.Tests
Issue651DeclaredSubpictureTests:0x21, which never carries a packet, is still a track, and a subpicture split across three PES packets arrives as one packet with the first fragment's PTS. This test fails when the assembler hook is bypassed.Full suite green locally: 3531 swift-testing tests + 17 XCTest.
Issue281ColdStartRoundTripTestsfailed once under full-suite load and passed when run alone and on a full rerun.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mf4MXgM9bqugHoe5TW4BYf