Skip to content

KaxBlock: rework EBML lacing sizes in SCOPE_PARTIAL_DATA mode#236

Open
robUx4 wants to merge 4 commits into
Matroska-Org:masterfrom
robUx4:partial-ebml-lacing
Open

KaxBlock: rework EBML lacing sizes in SCOPE_PARTIAL_DATA mode#236
robUx4 wants to merge 4 commits into
Matroska-Org:masterfrom
robUx4:partial-ebml-lacing

Conversation

@robUx4

@robUx4 robUx4 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

We only read the bytes that correspond to frame sizes, rather
than a guesstimate of how much data we are going to need.

That's what the SCOPE_PARTIAL_DATA mode is about. This is already the case
for LACING_XIPH. And we don't need a buffer allocation.

And throw when the EBML length difference gives a negative frame length.

@robUx4 robUx4 added the bug label Apr 28, 2026
robUx4 added 4 commits July 6, 2026 09:04
We only read the bytes that correspond to frame sizes, rather
than a guesstimate of how much data we are going to need.

That's what the SCOPE_PARTIAL_DATA mode is about. This is already the case
for LACING_XIPH. And we don't need a buffer allocation.
The spec [^1] is not clear whether when there is a single frame in the lace
the size of the frame should be written. However it is forbidden to put
a single frame in a lace [^2]. libmatroska doesn't support it.
libavformat doesn't support lacing writing.
However the last frame size is never written in any lace, so that's the
first one when there's only one frame.

[^1]: https://www.rfc-editor.org/rfc/rfc9559#section-10.3.3
[^2]: https://www.rfc-editor.org/rfc/rfc9559#section-10.3
No functional changes.
@robUx4 robUx4 force-pushed the partial-ebml-lacing branch from b0c8ccf to cec16eb Compare July 6, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant