Bug 1542021 - Part 0: Check that removeTrack with a stopped transceiver doesn't throw an error. r=jib
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 05 Apr 2019 15:46:25 +0000
changeset 468367 57ef4fc9dee88f2709448fe6d525735c19d2e503
parent 468366 048424eb3075256daa7ee76cd536d24d75505cee
child 468368 ca9b2ec29d981fbbc636bcea28314ba2717b75c5
push id35835
push useraciure@mozilla.com
push dateMon, 08 Apr 2019 19:00:29 +0000
treeherdermozilla-central@40456af7da1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1542021
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1542021 - Part 0: Check that removeTrack with a stopped transceiver doesn't throw an error. r=jib Differential Revision: https://phabricator.services.mozilla.com/D26314
testing/web-platform/tests/webrtc/RTCPeerConnection-removeTrack.https.html
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-removeTrack.https.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-removeTrack.https.html
@@ -287,16 +287,30 @@
     assert_equals(transceiver.currentDirection, 'inactive');
 
     pc.removeTrack(sender);
     assert_equals(sender.track, null);
     assert_equals(transceiver.direction, 'inactive');
     assert_equals(transceiver.currentDirection, 'inactive');
   }, 'Calling removeTrack with currentDirection inactive should not change direction');
 
+  promise_test(async t => {
+    const pc = new RTCPeerConnection();
+    t.add_cleanup(() => pc.close());
+    const stream = await navigator.mediaDevices.getUserMedia({audio: true});
+    t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
+    const [track] = stream.getTracks();
+    const sender = pc.addTrack(track, stream);
+
+    pc.getTransceivers()[0].stop();
+    pc.removeTrack(sender);
+    assert_equals(sender.track, track);
+  }, "Calling removeTrack on a stopped transceiver should be a no-op");
+
+
   /*
     TODO
       5.1.  removeTrack
         Stops sending media from sender. The RTCRtpSender will still appear
         in getSenders. Doing so will cause future calls to createOffer to
         mark the media description for the corresponding transceiver as
         recvonly or inactive, as defined in [JSEP] (section 5.2.2.).