Repository navigation
Conversation
FongMi
force-pushed
the
media3-mkv-linked-seekhead
branch
from
November 29, 2026 14:04
db7125f to
376df03
Compare
Collaborator
|
See #3588 (comment) |
FongMi
force-pushed
the
media3-mkv-linked-seekhead
branch
from
December 1, 2026 14:31
84ce8c8 to
7b66422
Compare
Some Matroska files reference Cues through a chain of SeekHeads. Follow the chain at the first Cluster and return to the saved media position after reading the index. Bound traversal and verify forward linked targets on unknown-length inputs before seeking. Discard malformed optional index targets while propagating errors from sequential reads. Retain the encoded Segment size for existing direct Cues consumers. Test the chained sample against the sample.mkv dumps and cover invalid indexes, premature sequential EOF and truncated HTTP responses. Issue: androidx#1143
FongMi
force-pushed
the
media3-mkv-linked-seekhead
branch
from
December 1, 2026 15:04
7b66422 to
b13eebf
Compare
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.
Summary
Follow linked SeekHead entries to find Matroska Cues in the case reported in #1143. At the first Cluster, follow the linked SeekHeads, read Cues if found, and return to the saved Cluster position. SeekHead and Cues targets share a 32-candidate limit and visited-offset checks.
When the input length is unknown, verify forward linked SeekHead targets and Cues discovered through them using up to 256 KiB of read-ahead before requesting a seek. Skip unusable candidates and continue sequential playback with an unseekable map if no usable index is found.
The traversal stays in
MatroskaExtractor. The optional index reader recognizes only SeekHead and Cues elements and can skip malformed index targets. Sequential read errors still propagate to the loader. The package-private unknown-size query onDefaultEbmlReaderis used for traversal bounds, while direct Cues retain their existing thumbnail and chunk-index output. TheEbmlReaderandEbmlProcessorinterfaces match upstream.Testing
MatroskaExtractorTestruns the three-SeekHead sample against the existingsample.mkvdumps. The sample is byte-identical to the one in Follow chainedSeekHeadelements to findCuesin Matroska #3588.STATE_ENDEDwith one request for both known-length and chunked responses.Coordination
This revision follows icbaker's guidance and is a candidate for the single linked-SeekHead PR discussed in #3588. Related proposals are #3526, #3579, #3588, and #3597.