Title: [215558] trunk
Revision
215558
Author
[email protected]
Date
2017-04-20 08:48:49 -0700 (Thu, 20 Apr 2017)

Log Message

RTCPeerConnection is stopping its backend twice sometimes
https://bugs.webkit.org/show_bug.cgi?id=171043

Patch by Youenn Fablet <[email protected]> on 2017-04-20
Reviewed by Eric Carlson.

Source/WebCore:

Test: webrtc/closing-peerconnection.html

Making sure we stop the backend only once.
Adding an internals API to close the peer connection so as to replicate frame disconnection.

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::doClose):
(WebCore::RTCPeerConnection::doStop):
* Modules/mediastream/RTCPeerConnection.h:
* testing/Internals.cpp:
(WebCore::Internals::stopPeerConnection):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* webrtc/closing-peerconnection-expected.txt: Added.
* webrtc/closing-peerconnection.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (215557 => 215558)


--- trunk/LayoutTests/ChangeLog	2017-04-20 12:57:40 UTC (rev 215557)
+++ trunk/LayoutTests/ChangeLog	2017-04-20 15:48:49 UTC (rev 215558)
@@ -1,3 +1,13 @@
+2017-04-20  Youenn Fablet  <[email protected]>
+
+        RTCPeerConnection is stopping its backend twice sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=171043
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/closing-peerconnection-expected.txt: Added.
+        * webrtc/closing-peerconnection.html: Added.
+
 2017-04-20  Joanmarie Diggs  <[email protected]>
 
         [ATK] Implement support for DPub ARIA roles

Added: trunk/LayoutTests/webrtc/closing-peerconnection-expected.txt (0 => 215558)


--- trunk/LayoutTests/webrtc/closing-peerconnection-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webrtc/closing-peerconnection-expected.txt	2017-04-20 15:48:49 UTC (rev 215558)
@@ -0,0 +1,3 @@
+
+PASS closing and stopping peer connection in the middle of gathering candidates 
+

Added: trunk/LayoutTests/webrtc/closing-peerconnection.html (0 => 215558)


--- trunk/LayoutTests/webrtc/closing-peerconnection.html	                        (rev 0)
+++ trunk/LayoutTests/webrtc/closing-peerconnection.html	2017-04-20 15:48:49 UTC (rev 215558)
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>Testing closing peer connection</title>
+        <script src=""
+        <script src=""
+    </head>
+    <body>
+        <script>
+promise_test((test) => {
+  return new Promise((resolve, reject) => {
+    var pc = new RTCPeerConnection();
+    pc._onicegatheringstatechange_ = (event) => {
+        if (pc.iceGatheringState == "gathering") {
+            pc.close();
+            if (window.internals)
+                internals.stopPeerConnection(pc);
+            resolve();
+        }
+    }
+    pc.createDataChannel("test");
+    pc.createOffer().then((desc) => pc.setLocalDescription(desc));
+  });
+}, "closing and stopping peer connection in the middle of gathering candidates");
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (215557 => 215558)


--- trunk/Source/WebCore/ChangeLog	2017-04-20 12:57:40 UTC (rev 215557)
+++ trunk/Source/WebCore/ChangeLog	2017-04-20 15:48:49 UTC (rev 215558)
@@ -1,3 +1,24 @@
+2017-04-20  Youenn Fablet  <[email protected]>
+
+        RTCPeerConnection is stopping its backend twice sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=171043
+
+        Reviewed by Eric Carlson.
+
+        Test: webrtc/closing-peerconnection.html
+
+        Making sure we stop the backend only once.
+        Adding an internals API to close the peer connection so as to replicate frame disconnection.
+
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::doClose):
+        (WebCore::RTCPeerConnection::doStop):
+        * Modules/mediastream/RTCPeerConnection.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::stopPeerConnection):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2017-04-20  Antti Koivisto  <[email protected]>
 
         Increase large animation cutoff

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (215557 => 215558)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2017-04-20 12:57:40 UTC (rev 215557)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2017-04-20 15:48:49 UTC (rev 215558)
@@ -362,8 +362,6 @@
     for (RTCRtpSender& sender : m_transceiverSet->senders())
         sender.stop();
 
-    m_backend->stop();
-
     return true;
 }
 
@@ -397,6 +395,9 @@
         return;
 
     m_isStopped = true;
+
+    m_backend->stop();
+
     unregisterFromController();
     unsetPendingActivity(this);
 }
@@ -468,6 +469,7 @@
 {
     RTCPeerConnectionState state;
 
+    // FIXME: In case m_iceGatheringState is RTCIceGatheringState::Gathering, and m_iceConnectionState is Closed, we should have the connection state be Closed.
     if (m_iceConnectionState == RTCIceConnectionState::New && m_iceGatheringState == RTCIceGatheringState::New)
         state = RTCPeerConnectionState::New;
     else if (m_iceConnectionState == RTCIceConnectionState::Checking || m_iceGatheringState == RTCIceGatheringState::Gathering)

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (215557 => 215558)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2017-04-20 12:57:40 UTC (rev 215557)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2017-04-20 15:48:49 UTC (rev 215558)
@@ -159,7 +159,7 @@
     void derefEventTarget() final { deref(); }
 
     // ActiveDOMObject
-    void stop() final;
+    WEBCORE_EXPORT void stop() final;
     const char* activeDOMObjectName() const final;
     bool canSuspendForDocumentSuspension() const final;
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (215557 => 215558)


--- trunk/Source/WebCore/testing/Internals.cpp	2017-04-20 12:57:40 UTC (rev 215557)
+++ trunk/Source/WebCore/testing/Internals.cpp	2017-04-20 15:48:49 UTC (rev 215558)
@@ -1311,6 +1311,12 @@
 #endif
 }
 
+void Internals::stopPeerConnection(RTCPeerConnection& connection)
+{
+    ActiveDOMObject& object = connection;
+    object.stop();
+}
+
 #endif
 
 #if ENABLE(MEDIA_STREAM)

Modified: trunk/Source/WebCore/testing/Internals.h (215557 => 215558)


--- trunk/Source/WebCore/testing/Internals.h	2017-04-20 12:57:40 UTC (rev 215557)
+++ trunk/Source/WebCore/testing/Internals.h	2017-04-20 15:48:49 UTC (rev 215558)
@@ -427,6 +427,7 @@
     void useMockRTCPeerConnectionFactory(const String&);
     void setICECandidateFiltering(bool);
     void setEnumeratingAllNetworkInterfacesEnabled(bool);
+    void stopPeerConnection(RTCPeerConnection&);
 #endif
 
     String getImageSourceURL(Element&);

Modified: trunk/Source/WebCore/testing/Internals.idl (215557 => 215558)


--- trunk/Source/WebCore/testing/Internals.idl	2017-04-20 12:57:40 UTC (rev 215557)
+++ trunk/Source/WebCore/testing/Internals.idl	2017-04-20 15:48:49 UTC (rev 215558)
@@ -461,6 +461,7 @@
     [Conditional=WEB_RTC] void useMockRTCPeerConnectionFactory(DOMString testCase);
     [Conditional=WEB_RTC] void setICECandidateFiltering(boolean enabled);
     [Conditional=WEB_RTC] void setEnumeratingAllNetworkInterfacesEnabled(boolean enabled);
+    [Conditional=WEB_RTC] void stopPeerConnection(RTCPeerConnection connection);
 
     [Conditional=VIDEO] void simulateSystemSleep();
     [Conditional=VIDEO] void simulateSystemWake();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to