Clear current_direction when the RtpTransceiver is stopped
This is specified in the WebRTC specification:
https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
Bug: webrtc:7600
Change-Id: I4c3d434528f8c2aecad9d86dce38f13cf4fee560
Reviewed-on: https://webrtc-review.googlesource.com/55900
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22112}
diff --git a/pc/peerconnection_jsep_unittest.cc b/pc/peerconnection_jsep_unittest.cc
index ac17df2..f77579b 100644
--- a/pc/peerconnection_jsep_unittest.cc
+++ b/pc/peerconnection_jsep_unittest.cc
@@ -1228,4 +1228,19 @@
// TODO(bugs.webrtc.org/7932): Also test multi-stream case.
+// Test that if an RtpTransceiver with a current_direction set is stopped, then
+// current_direction is changed to null.
+TEST_F(PeerConnectionJsepTest, CurrentDirectionResetWhenRtpTransceiverStopped) {
+ auto caller = CreatePeerConnection();
+ auto callee = CreatePeerConnection();
+
+ auto transceiver = caller->AddTransceiver(cricket::MEDIA_TYPE_AUDIO);
+
+ ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get()));
+
+ ASSERT_TRUE(transceiver->current_direction());
+ transceiver->Stop();
+ EXPECT_FALSE(transceiver->current_direction());
+}
+
} // namespace webrtc