diff --git a/rtc/src/peer_connection/internal.rs b/rtc/src/peer_connection/internal.rs index 63d3627..57da134 100644 --- a/rtc/src/peer_connection/internal.rs +++ b/rtc/src/peer_connection/internal.rs @@ -847,7 +847,7 @@ where } /// Helper to trigger a negotiation needed. - pub(super) fn trigger_negotiation_needed(&mut self) { + pub(crate) fn trigger_negotiation_needed(&mut self) { if !self.do_negotiation_needed() { return; } diff --git a/rtc/src/rtp_transceiver/internal.rs b/rtc/src/rtp_transceiver/internal.rs index efe1978..34612bb 100644 --- a/rtc/src/rtp_transceiver/internal.rs +++ b/rtc/src/rtp_transceiver/internal.rs @@ -155,9 +155,6 @@ where if direction != previous_direction { trace!("Changing direction of transceiver from {previous_direction} to {direction}"); - - //TODO: https://www.w3.org/TR/webrtc/#dom-rtcrtptransceiver-direction - // Update the negotiation-needed flag for connection. } } diff --git a/rtc/src/rtp_transceiver/mod.rs b/rtc/src/rtp_transceiver/mod.rs index 1eacff2..b990181 100644 --- a/rtc/src/rtp_transceiver/mod.rs +++ b/rtc/src/rtp_transceiver/mod.rs @@ -289,7 +289,12 @@ where pub fn set_direction(&mut self, direction: RTCRtpTransceiverDirection) { // peer_connection is mutable borrow, its rtp_transceivers won't be resized, // so, [self.id] here is safe. + let previous = self.peer_connection.rtp_transceivers[self.id].direction(); self.peer_connection.rtp_transceivers[self.id].set_direction(direction); + // Per W3C WebRTC ยง5.5: changing direction must trigger renegotiation. + if direction != previous { + self.peer_connection.trigger_negotiation_needed(); + } } /// Returns the negotiated direction of the transceiver.