Skip to content

fix(sdp): reflect rejected m-lines (port=0) in answer per RFC 8829 §5.3.1#67

Open
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:fix/rfc8829-rejected-mlines
Open

fix(sdp): reflect rejected m-lines (port=0) in answer per RFC 8829 §5.3.1#67
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:fix/rfc8829-rejected-mlines

Conversation

@nightness
Copy link
Copy Markdown

Summary

  • Adds rejected / rejected_kind fields to MediaSection (all existing construction sites use ..Default::default() — no breakage).
  • populate_sdp now emits a minimal port=0 m-line for each rejected section before the normal transceiver loop.
  • generate_matched_sdp pushes a rejected MediaSection instead of silently skipping a section whose direction is Unspecified (port=0 in offer).

Why This Matters (RFC 8829 §5.3.1)

If a remote offer contains an m= section that is rejected (port 0), the
local answer MUST also contain an m= section with port 0. Rejected
sections must stay in the same position to preserve m-line indexing for
subsequent offers.

Without this fix, a remote peer that sends an offer with one or more
rejected m-lines will get an answer whose m-line indices are shifted,
causing subsequent re-offers to mis-map transceivers.

Test Plan

  • cargo build -p rtc passes (verified)
  • Offer with rejected m-line generates an answer with port=0 in the same position
  • Normal offers without rejected m-lines are unaffected

🤖 Generated with Claude Code

….3.1

When an offer contains a rejected m-line (port=0 / no direction), the
answer must reflect it in the same position with port=0 to preserve
m-line indexing.  Without this, re-offers after a rejected section would
mis-map subsequent transceivers.

Adds `rejected` / `rejected_kind` fields to `MediaSection` (all existing
construction sites use `..Default::default()` so there is no breakage).
`populate_sdp` emits a minimal port=0 section for rejected lines before
the normal transceiver loop.  `generate_matched_sdp` now pushes a
rejected `MediaSection` instead of silently skipping a section whose
direction is `Unspecified`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant