Skip to content

Fix CSRC offsets when parsing RTP media packets - #983

Merged
zxzxwu merged 1 commit into
google:mainfrom
kwy404:fix-rtp-csrc-offset
Sep 24, 2026
Merged

zxzxwu merged 1 commit into
google:mainfrom
kwy404:fix-rtp-csrc-offset

Conversation

@kwy404

@kwy404 kwy404 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

MediaPacket.from_bytes() read the CSRC list at 12 + 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_list in tests/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).

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
zxzxwu merged commit 97413d5 into google:main Sep 24, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants