Fix Packet::write* rejecting zero-sized packets that carry side data#265
Open
axel10 wants to merge 1 commit into
Open
Fix Packet::write* rejecting zero-sized packets that carry side data#265axel10 wants to merge 1 commit into
Packet::write* rejecting zero-sized packets that carry side data#265axel10 wants to merge 1 commit into
Conversation
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.
Packet::write()andPacket::write_interleaved()currently returnError::InvalidDatawheneverpacket.size == 0.That is stricter than FFmpeg's own
av_write_frame()/av_interleaved_write_frame()behavior. FFmpeg allows packets with no payloaddata as long as they still carry side data. One real example is the FLAC
encoder flush path, which can emit a zero-sized packet containing
AV_PKT_DATA_NEW_EXTRADATAso the muxer can update the final STREAMINFO block.With the current wrapper behavior, those packets are rejected before they ever
reach FFmpeg, which makes otherwise valid FLAC muxing fail from Rust.
This patch changes the pre-check so only packets that have neither payload nor
side data are rejected. Zero-sized packets with side data are now forwarded to
FFmpeg, matching the underlying C API semantics more closely.
Also included: