Skip to content

fix(rtp_transceiver): trigger renegotiation on set_direction (closes #51)#71

Open
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:fix/set-direction-renegotiation
Open

fix(rtp_transceiver): trigger renegotiation on set_direction (closes #51)#71
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:fix/set-direction-renegotiation

Conversation

@nightness
Copy link
Copy Markdown

Summary

  • RTCRtpTransceiver::set_direction() now calls trigger_negotiation_needed() on the peer connection when the direction actually changes, per W3C WebRTC §5.5
  • The fix is in the public wrapper (rtp_transceiver/mod.rs), which already holds &mut RTCPeerConnection — no architectural changes needed
  • The now-resolved //TODO comment in internal.rs is removed
  • trigger_negotiation_needed() visibility is broadened from pub(super) to pub(crate) to allow the call from rtp_transceiver/mod.rs

Test plan

  • cargo build passes
  • cargo test -p rtc passes (246 tests)
  • Manual: calling transceiver.set_direction(RTCRtpTransceiverDirection::Inactive) causes on_negotiation_needed to fire on the peer connection; calling it with the same direction does not

🤖 Generated with Claude Code

…ebrtc-rs#51)

Per W3C WebRTC §5.5, changing an RTCRtpTransceiver's direction must
trigger the negotiation-needed flag so the application knows to
create a new offer/answer exchange.

The internal set_direction() had a TODO noting this was missing.
The fix lives in the public RTCRtpTransceiver::set_direction() wrapper,
which already holds &mut RTCPeerConnection and can call
trigger_negotiation_needed() directly after detecting a direction change.

Also broaden trigger_negotiation_needed() visibility from pub(super) to
pub(crate) so rtp_transceiver/mod.rs can reach it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nightness nightness force-pushed the fix/set-direction-renegotiation branch from e08e980 to 6ad88b6 Compare April 1, 2026 18:43
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