Title: [260814] trunk
Revision
260814
Author
[email protected]
Date
2020-04-28 03:08:53 -0700 (Tue, 28 Apr 2020)

Log Message

RTCPeerConnection should not remove its created remote MediaStream objects until getting close
https://bugs.webkit.org/show_bug.cgi?id=211070

Reviewed by Alex Christensen.

Source/WebCore:

Remove no longer needed code.
This aligns with the spec and Firefox implementation.
Test: webrtc/direction-change.html

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::transceiverBackendFromSender):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:

LayoutTests:

* webrtc/direction-change-expected.txt: Added.
* webrtc/direction-change.html: Added.
* webrtc/routines.js:
* webrtc/video-setDirection-expected.txt:
* webrtc/video-setDirection.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (260813 => 260814)


--- trunk/LayoutTests/ChangeLog	2020-04-28 09:57:41 UTC (rev 260813)
+++ trunk/LayoutTests/ChangeLog	2020-04-28 10:08:53 UTC (rev 260814)
@@ -1,3 +1,16 @@
+2020-04-28  Youenn Fablet  <[email protected]>
+
+        RTCPeerConnection should not remove its created remote MediaStream objects until getting close
+        https://bugs.webkit.org/show_bug.cgi?id=211070
+
+        Reviewed by Alex Christensen.
+
+        * webrtc/direction-change-expected.txt: Added.
+        * webrtc/direction-change.html: Added.
+        * webrtc/routines.js:
+        * webrtc/video-setDirection-expected.txt:
+        * webrtc/video-setDirection.html:
+
 2020-04-27  Simon Fraser  <[email protected]>
 
         Do correct clipping of composited replaced elements with border-radius

Added: trunk/LayoutTests/webrtc/direction-change-expected.txt (0 => 260814)


--- trunk/LayoutTests/webrtc/direction-change-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webrtc/direction-change-expected.txt	2020-04-28 10:08:53 UTC (rev 260814)
@@ -0,0 +1,8 @@
+
+
+PASS Setup connection with sendonly transceiver 
+PASS Set transceiver as inactive 
+PASS Set transceiver as sendonly 
+PASS track event stream test - audio 
+PASS track event stream test - video 
+

Added: trunk/LayoutTests/webrtc/direction-change.html (0 => 260814)


--- trunk/LayoutTests/webrtc/direction-change.html	                        (rev 0)
+++ trunk/LayoutTests/webrtc/direction-change.html	2020-04-28 10:08:53 UTC (rev 260814)
@@ -0,0 +1,54 @@
+<!doctype html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>MediaStream objects should remain the same for a remote track when changing direction</title>
+        <script src=""
+        <script src=""
+    </head>
+    <body>
+        <video id="video" autoplay=""></video>
+        <script src =""
+        <script>
+var pc1, pc2;
+var remoteStream;
+var trackEventCounter = 0;
+promise_test(async () => {
+    const localStream = await navigator.mediaDevices.getUserMedia({audio: true, video: true});
+    remoteStream = await new Promise((resolve, reject) => {
+        createConnections((firstConnection) => {
+            pc1 = firstConnection;
+            pc1.addTrack(localStream.getAudioTracks()[0], localStream);
+            pc1.addTrack(localStream.getVideoTracks()[0], localStream);
+            pc1.getTransceivers().forEach(transceiver => transceiver.direction = "sendonly");
+        }, (secondConnection) => {
+            pc2 = secondConnection;
+            pc2._ontrack_ = (trackEvent) => {
+                resolve(trackEvent.streams[0]);
+            };
+        });
+        setTimeout(() => reject("Test timed out"), 5000);
+    });
+    video.srcObject = remoteStream;
+    await video.play();
+}, "Setup connection with sendonly transceiver");
+
+promise_test(async () => {
+    pc1.getTransceivers().forEach(transceiver => transceiver.direction = "inactive");
+    return renegotiate(pc1, pc2);
+}, "Set transceiver as inactive");
+
+promise_test(async () => {
+    // Setting direction to sendonly will trigger two new track events.
+    pc2._ontrack_ = (trackEvent) => {
+         test(() => {
+             assert_equals(remoteStream, trackEvent.streams[0]);
+         }, "track event stream test - " + trackEvent.track.kind);
+    };
+
+    pc1.getTransceivers().forEach(transceiver => transceiver.direction = "sendonly");
+    return renegotiate(pc1, pc2);
+}, "Set transceiver as sendonly");
+        </script>
+    </body>
+</html>

Modified: trunk/LayoutTests/webrtc/routines.js (260813 => 260814)


--- trunk/LayoutTests/webrtc/routines.js	2020-04-28 09:57:41 UTC (rev 260813)
+++ trunk/LayoutTests/webrtc/routines.js	2020-04-28 10:08:53 UTC (rev 260814)
@@ -78,6 +78,16 @@
     assert_unreached();
 }
 
+async function renegotiate(pc1, pc2)
+{
+    let d = await pc1.createOffer();
+    await pc1.setLocalDescription(d);
+    await pc2.setRemoteDescription(d);
+    d = await pc2.createAnswer();
+    await pc1.setRemoteDescription(d);
+    await pc2.setLocalDescription(d);
+}
+
 function analyseAudio(stream, duration, context)
 {
     return new Promise((resolve, reject) => {

Modified: trunk/LayoutTests/webrtc/video-setDirection-expected.txt (260813 => 260814)


--- trunk/LayoutTests/webrtc/video-setDirection-expected.txt	2020-04-28 09:57:41 UTC (rev 260813)
+++ trunk/LayoutTests/webrtc/video-setDirection-expected.txt	2020-04-28 10:08:53 UTC (rev 260814)
@@ -1,5 +1,5 @@
 
 
 PASS Going from sendrecv to inactive and back to sendrecv 
-FAIL The MediaStream should remain the same assert_equals: expected object "[object MediaStream]" but got object "[object MediaStream]"
+PASS The MediaStream should remain the same 
 

Modified: trunk/LayoutTests/webrtc/video-setDirection.html (260813 => 260814)


--- trunk/LayoutTests/webrtc/video-setDirection.html	2020-04-28 09:57:41 UTC (rev 260813)
+++ trunk/LayoutTests/webrtc/video-setDirection.html	2020-04-28 10:08:53 UTC (rev 260814)
@@ -44,15 +44,6 @@
 }
 
 var pc1, pc2;
-async function renegotiate()
-{
-    let d = await pc1.createOffer();
-    await pc1.setLocalDescription(d);
-    await pc2.setRemoteDescription(d);
-    d = await pc2.createAnswer();
-    await pc1.setRemoteDescription(d);
-    await pc2.setLocalDescription(d);
-}
 
 promise_test(async (t) => {
     if (window.testRunner)
@@ -80,7 +71,7 @@
     });
 
     pc1.getTransceivers()[0].direction = "inactive";
-    await renegotiate();
+    await renegotiate(pc1, pc2);
     await promise;
 
     promise = new Promise((resolve) => {
@@ -92,7 +83,7 @@
         pc2._ontrack_ = (trackEvent) => { resolve (trackEvent.streams[0]); };
     });
 
-    await renegotiate();
+    await renegotiate(pc1, pc2);
     video.srcObject = await streamPromise;
     await promise;
 

Modified: trunk/Source/WebCore/ChangeLog (260813 => 260814)


--- trunk/Source/WebCore/ChangeLog	2020-04-28 09:57:41 UTC (rev 260813)
+++ trunk/Source/WebCore/ChangeLog	2020-04-28 10:08:53 UTC (rev 260814)
@@ -1,5 +1,20 @@
 2020-04-28  Youenn Fablet  <[email protected]>
 
+        RTCPeerConnection should not remove its created remote MediaStream objects until getting close
+        https://bugs.webkit.org/show_bug.cgi?id=211070
+
+        Reviewed by Alex Christensen.
+
+        Remove no longer needed code.
+        This aligns with the spec and Firefox implementation.
+        Test: webrtc/direction-change.html
+
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::transceiverBackendFromSender):
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+
+2020-04-28  Youenn Fablet  <[email protected]>
+
         Ensure remote track event gets unmuted after the track event is fired
         https://bugs.webkit.org/show_bug.cgi?id=211071
 

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (260813 => 260814)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2020-04-28 09:57:41 UTC (rev 260813)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2020-04-28 10:08:53 UTC (rev 260814)
@@ -481,22 +481,6 @@
     return nullptr;
 }
 
-void LibWebRTCMediaEndpoint::removeRemoteStream(webrtc::MediaStreamInterface& rtcStream)
-{
-    bool removed = m_remoteStreamsById.remove(fromStdString(rtcStream.id()));
-    ASSERT_UNUSED(removed, removed);
-}
-
-void LibWebRTCMediaEndpoint::OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream)
-{
-    callOnMainThread([protectedThis = makeRef(*this), stream = WTFMove(stream)] {
-        if (protectedThis->isStopped())
-            return;
-        ASSERT(stream);
-        protectedThis->removeRemoteStream(*stream.get());
-    });
-}
-
 void LibWebRTCMediaEndpoint::OnTrack(rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver)
 {
     callOnMainThread([protectedThis = makeRef(*this), transceiver = WTFMove(transceiver)]() mutable {

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h (260813 => 260814)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h	2020-04-28 09:57:41 UTC (rev 260813)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h	2020-04-28 10:08:53 UTC (rev 260814)
@@ -122,7 +122,6 @@
 
     // webrtc::PeerConnectionObserver API
     void OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState) final;
-    void OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface>) final;
     void OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface>) final;
     void OnTrack(rtc::scoped_refptr<webrtc::RtpTransceiverInterface>) final;
     void OnRemoveTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface>) final;
@@ -139,7 +138,6 @@
     void setLocalSessionDescriptionFailed(ExceptionCode, const char*);
     void setRemoteSessionDescriptionSucceeded();
     void setRemoteSessionDescriptionFailed(ExceptionCode, const char*);
-    void removeRemoteStream(webrtc::MediaStreamInterface&);
     void newTransceiver(rtc::scoped_refptr<webrtc::RtpTransceiverInterface>&&);
     void removeRemoteTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface>&&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to