Repository navigation
Fix CSRC offsets when parsing RTP media packets - #983
Merged
Merged
Conversation
Each CSRC identifier is 4 bytes, but MediaPacket.from_bytes stepped the read offset by 1, so any packet with more than one CSRC was decoded with overlapping values.
zxzxwu
approved these changes
Sep 24, 2026
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.
MediaPacket.from_bytes()read the CSRC list at12 + i, but each CSRC identifier is 4 bytes (RFC 3550), so packets with more than one CSRC came back with overlapping values.__bytes__and the payload offset right below already use 4-byte steps, so this was only wrong on the parsing side.Added
test_media_packet_csrc_listintests/a2dp_test.py, which round-trips a packet with two CSRCs. It fails before the change and passes after. Ran black, ruff and mypy on the touched files, plus the full test suite (the only failures are the android-netsim transport tests, which need grpcio and fail the same way on main).