fix(endpoint): route RTX/FEC repair packets to primary stream receiver#75
Open
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Open
fix(endpoint): route RTX/FEC repair packets to primary stream receiver#75nightness wants to merge 1 commit intowebrtc-rs:masterfrom
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Conversation
Three bugs caused all RTX/FEC repair packets to be silently dropped: 1. find_track_id_by_ssrc: outer SSRC search only matched primary SSRCs (coding.ssrc). RTX/FEC SSRCs live in coding.rtx.ssrc / coding.fec.ssrc and were never found. Fix: extend the .any() predicate to also check rtx/fec SSRCs; when matched via repair SSRC, return the primary stream's track_id immediately without triggering OnOpen events. 2. find_track_id_by_rid (rrid branch): after correctly associating the repair SSRC with the base stream's RTX parameters, the function fell through to None instead of returning Some(track_id). RTX packets with the rrid header extension were always dropped on every packet. 3. handle_undeclared_ssrc: codec lookup could match the RTX codec entry (which IS in codec_preferences) and incorrectly set up a repair stream as a primary track. Fix: explicitly exclude RTX codecs so only primary codecs are accepted here. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9b00c53 to
71e8f84
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
Three bugs caused all RTX/FEC repair packets to be silently dropped:
Bug 1 —
find_track_id_by_ssrc: outer SSRC search misses repair SSRCsRTX/FEC SSRCs live in
coding.rtx.ssrc/coding.fec.ssrc, notcoding.ssrc. The outer transceiver search only checkedcoding.ssrc, so any packet with an RTX or FEC SSRC fell through toNoneand was dropped. Fix: extend the.any()predicate to also checkrtx/fecSSRCs. When a match is found via repair SSRC, the packet is routed to the primary stream's receiver immediately without firingOnOpenevents.Bug 2 —
find_track_id_by_rid(rridbranch): always returnedNoneThe
rridheader extension identifies a repair packet for a base stream identified byrid. The code correctly updatedcoding.rtx.ssrc = ssrc, but then fell through toNoneinstead of returning the primary stream'strack_id. Every RTX packet carryingrridwas dropped. Fix: addreturn Some(receiver.track().track_id().clone())after the SSRC update.Bug 3 —
handle_undeclared_ssrc: RTX codec matched as primaryRTX codec entries are included in
get_codec_preferences()(added during SDP negotiation). If an RTX packet arrived first in the single-section non-rid path, the codec lookup would find the RTX codec and incorrectly set it up as the primary track's codec. Fix: exclude RTX mime-type codecs from the lookup so only primary codecs are accepted.Test plan
cargo test -p rtc— all 246 tests passOnOpenis not fired for RTX SSRC sub-streams🤖 Generated with Claude Code