Title: [237916] trunk
Revision
237916
Author
[email protected]
Date
2018-11-06 22:05:04 -0800 (Tue, 06 Nov 2018)

Log Message

sender.replaceTrack() fails with InvalidStateError if the transceiver.direction is "inactive"
https://bugs.webkit.org/show_bug.cgi?id=191202

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

Changes made upstreamed.

* web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https.html:

Source/WebCore:

Covered by updated test.

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::removeTrack):
Update as per spec, in particular make sure to not stop the sender when removing the track.

LayoutTests:

* TestExpectations: skipping a timing out related test.
It is already timing out but is also flaky.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237915 => 237916)


--- trunk/LayoutTests/ChangeLog	2018-11-07 05:58:15 UTC (rev 237915)
+++ trunk/LayoutTests/ChangeLog	2018-11-07 06:05:04 UTC (rev 237916)
@@ -1,3 +1,13 @@
+2018-11-06  Youenn Fablet  <[email protected]>
+
+        sender.replaceTrack() fails with InvalidStateError if the transceiver.direction is "inactive"
+        https://bugs.webkit.org/show_bug.cgi?id=191202
+
+        Reviewed by Eric Carlson.
+
+        * TestExpectations: skipping a timing out related test.
+        It is already timing out but is also flaky.
+
 2018-11-06  Justin Fan  <[email protected]>
 
         [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain

Modified: trunk/LayoutTests/TestExpectations (237915 => 237916)


--- trunk/LayoutTests/TestExpectations	2018-11-07 05:58:15 UTC (rev 237915)
+++ trunk/LayoutTests/TestExpectations	2018-11-07 06:05:04 UTC (rev 237916)
@@ -1226,6 +1226,8 @@
 imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-ontrack.https.html [ Skip ]
 imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-offer.html [ Failure ]
 imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver.https.html [ Failure ]
+# Skip timing out test
+imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html [ Skip ]
 
 # Uses legacy WebRTC API.
 imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/setRemoteDescription.html [ Skip ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (237915 => 237916)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-07 05:58:15 UTC (rev 237915)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-07 06:05:04 UTC (rev 237916)
@@ -1,5 +1,17 @@
 2018-11-06  Youenn Fablet  <[email protected]>
 
+        sender.replaceTrack() fails with InvalidStateError if the transceiver.direction is "inactive"
+        https://bugs.webkit.org/show_bug.cgi?id=191202
+
+        Reviewed by Eric Carlson.
+
+        Changes made upstreamed.
+
+        * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https-expected.txt:
+        * web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https.html:
+
+2018-11-06  Youenn Fablet  <[email protected]>
+
         Add support for sender/receiver getCapabilities
         https://bugs.webkit.org/show_bug.cgi?id=191192
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https-expected.txt (237915 => 237916)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https-expected.txt	2018-11-07 05:58:15 UTC (rev 237915)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https-expected.txt	2018-11-07 06:05:04 UTC (rev 237916)
@@ -1,10 +1,7 @@
 
-Harness Error (TIMEOUT), message = null
-
 PASS replaceTrack() sets the track attribute to a new track. 
 PASS replaceTrack() sets the track attribute to null. 
 PASS replaceTrack() does not set the track synchronously. 
 PASS replaceTrack() rejects when the peer connection is closed. 
-FAIL replaceTrack() rejects when invoked after removeTrack(). assert_equals: expected "InvalidModificationError" but got "InvalidStateError"
-TIMEOUT replaceTrack() rejects after a subsequent removeTrack(). Test timed out
+PASS replaceTrack() rejects when invoked after removeTrack(). 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https.html (237915 => 237916)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https.html	2018-11-07 05:58:15 UTC (rev 237915)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-replaceTrack.https.html	2018-11-07 06:05:04 UTC (rev 237916)
@@ -85,58 +85,17 @@
     }));
   }, 'replaceTrack() rejects when the peer connection is closed.');
 
-  async_test(t => {
+  promise_test(async t => {
     const expectedException = 'InvalidModificationError';
     const caller = new RTCPeerConnection();
     t.add_cleanup(() => caller.close());
-    return getUserMediaTracksAndStreams(2)
-    .then(t.step_func(([tracks, streams]) => {
-      const sender = caller.addTrack(tracks[0], streams[0]);
-      caller.removeTrack(sender);
-      // replaceTrack() should fail because the sender should be inactive after
-      // removeTrack().
-      return sender.replaceTrack(tracks[1])
-      .then(t.step_func(() => {
-        assert_unreached('Expected replaceTrack() to be rejected with ' +
-                         expectedException + ' but the promise was resolved.');
-      }),
-      t.step_func(e => {
-        assert_equals(e.name, expectedException);
-        t.done();
-      }));
-    }))
-    .catch(t.step_func(reason => {
-      assert_unreached(reason);
-    }));
+    const [tracks, streams] = await getUserMediaTracksAndStreams(2);
+    const sender = caller.addTrack(tracks[0], streams[0]);
+    caller.removeTrack(sender);
+    await sender.replaceTrack(tracks[1]);
+    assert_equals(sender.track, tracks[1], "Make sure track gets updated");
   }, 'replaceTrack() rejects when invoked after removeTrack().');
 
-  async_test(t => {
-    const expectedException = 'InvalidModificationError';
-    const caller = new RTCPeerConnection();
-    t.add_cleanup(() => caller.close());
-    return getUserMediaTracksAndStreams(2)
-    .then(t.step_func(([tracks, streams]) => {
-      const sender = caller.addTrack(tracks[0], streams[0]);
-      let p = sender.replaceTrack(tracks[1])
-      caller.removeTrack(sender);
-      // replaceTrack() should fail because it executes steps in parallel and
-      // queues a task to execute after removeTrack() has occurred. The sender
-      // should be inactive. If this can be racy, update or remove the test.
-      // https://github.com/w3c/webrtc-pc/issues/1728
-      return p.then(t.step_func(() => {
-        assert_unreached('Expected replaceTrack() to be rejected with ' +
-                         expectedException + ' but the promise was resolved.');
-      }),
-      t.step_func(e => {
-        assert_equals(e.name, expectedException);
-        t.done();
-      }));
-    }))
-    .catch(t.step_func(reason => {
-      assert_unreached(reason);
-    }));
-  }, 'replaceTrack() rejects after a subsequent removeTrack().');
-
   // TODO(hbos): Verify that replaceTrack() changes what media is received on
   // the remote end of two connected peer connections. For video tracks, this
   // requires Chromium's video tag to update on receiving frames when running

Modified: trunk/Source/WebCore/ChangeLog (237915 => 237916)


--- trunk/Source/WebCore/ChangeLog	2018-11-07 05:58:15 UTC (rev 237915)
+++ trunk/Source/WebCore/ChangeLog	2018-11-07 06:05:04 UTC (rev 237916)
@@ -1,3 +1,16 @@
+2018-11-06  Youenn Fablet  <[email protected]>
+
+        sender.replaceTrack() fails with InvalidStateError if the transceiver.direction is "inactive"
+        https://bugs.webkit.org/show_bug.cgi?id=191202
+
+        Reviewed by Eric Carlson.
+
+        Covered by updated test.
+
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::removeTrack):
+        Update as per spec, in particular make sure to not stop the sender when removing the track.
+
 2018-11-06  Justin Fan  <[email protected]>
 
         [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (237915 => 237916)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2018-11-07 05:58:15 UTC (rev 237915)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2018-11-07 06:05:04 UTC (rev 237916)
@@ -134,9 +134,11 @@
         return Exception { InvalidStateError };
 
     bool shouldAbort = true;
-    for (RTCRtpSender& senderInSet : m_transceiverSet->senders()) {
-        if (&senderInSet == &sender) {
-            shouldAbort = sender.isStopped();
+    RTCRtpTransceiver* senderTransceiver = nullptr;
+    for (auto& transceiver : m_transceiverSet->list()) {
+        if (&sender == &transceiver->sender()) {
+            senderTransceiver = transceiver.get();
+            shouldAbort = sender.isStopped() || !sender.track();
             break;
         }
     }
@@ -143,8 +145,9 @@
     if (shouldAbort)
         return { };
 
+    sender.setTrackToNull();
+    senderTransceiver->disableSendingDirection();
     m_backend->removeTrack(sender);
-    sender.stop();
     return { };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to