Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Feb 2019 18:49:23 +0000 (18:49 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Feb 2019 18:49:23 +0000 (18:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194380
<rdar://problem/47916514>

Reviewed by Eric Carlson.

Source/WebCore:

Set whether VP8 is supported at creation of the page.
This ensures that any call creating a peer connection factory will end up supporting the runtime flag configuration.

Add internal API to enable resetting the factory to enable proper testing.

Covered by updated test.

* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::createLibWebRTCPeerConnectionBackend):
* page/Page.cpp:
(WebCore::m_applicationManifest):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
* testing/Internals.cpp:
(WebCore::Internals::clearPeerConnectionFactory):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* webrtc/video-mute-vp8-expected.txt:
* webrtc/video-mute-vp8.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241200 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/webrtc/video-mute-vp8-expected.txt
LayoutTests/webrtc/video-mute-vp8.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index 0ba0400..f8008d7 100644 (file)
@@ -1,3 +1,14 @@
+2019-02-08  Youenn Fablet  <youenn@apple.com>
+
+        Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
+        https://bugs.webkit.org/show_bug.cgi?id=194380
+        <rdar://problem/47916514>
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/video-mute-vp8-expected.txt:
+        * webrtc/video-mute-vp8.html:
+
 2019-02-08  Andy Estes  <aestes@apple.com>
 
         [WebIDL] Support serializing sequences and FrozenArrays of non-interfaces
index 0a25875..6949db4 100644 (file)
@@ -2,6 +2,7 @@ Video should be running, go to black and running.
 Following, should be a snapshot of the video, a black frame and a snapshot of the video.
   
 
+PASS Verify VP8 activation 
 PASS Setting video exchange 
 PASS Ensuring connection state is connected 
 PASS Track is enabled, video should not be black 
index d5604a0..d614193 100644 (file)
         <canvas id="canvas3" width="320" height="240"></canvas>
         <script src ="routines.js"></script>
         <script>
+promise_test(async (test) => {
+    if (window.internals)
+        window.internals.clearPeerConnectionFactory();
+
+    const codecs = RTCRtpSender.getCapabilities("video").codecs;
+    assert_true(codecs.some((codec) => { return codec.mimeType.indexOf("VP8") }), "VP8 is listed as a codec");
+
+    const pc = new RTCPeerConnection();
+    pc.addTransceiver("video");
+    const description = await pc.createOffer();
+    pc.close();
+    assert_true(description.sdp.indexOf("VP8") !== -1, "VP8 codec is in the SDP");
+}, "Verify VP8 activation")
+
 var track;
 var remoteTrack;
 var receivingConnection;
index 3001c5d..b7b3ff3 100644 (file)
@@ -1,3 +1,28 @@
+2019-02-08  Youenn Fablet  <youenn@apple.com>
+
+        Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
+        https://bugs.webkit.org/show_bug.cgi?id=194380
+        <rdar://problem/47916514>
+
+        Reviewed by Eric Carlson.
+
+        Set whether VP8 is supported at creation of the page.
+        This ensures that any call creating a peer connection factory will end up supporting the runtime flag configuration.
+
+        Add internal API to enable resetting the factory to enable proper testing.
+
+        Covered by updated test.
+
+        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
+        (WebCore::createLibWebRTCPeerConnectionBackend):
+        * page/Page.cpp:
+        (WebCore::m_applicationManifest):
+        * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::clearPeerConnectionFactory):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2019-02-08  Andy Estes  <aestes@apple.com>
 
         [WebIDL] Support serializing sequences and FrozenArrays of non-interfaces
index 1253c0f..6bc001f 100644 (file)
@@ -58,9 +58,6 @@ static std::unique_ptr<PeerConnectionBackend> createLibWebRTCPeerConnectionBacke
     if (!page)
         return nullptr;
 
-#if USE(LIBWEBRTC)
-    page->libWebRTCProvider().supportsVP8(RuntimeEnabledFeatures::sharedFeatures().webRTCVP8CodecEnabled());
-#endif
     return std::make_unique<LibWebRTCPeerConnectionBackend>(peerConnection, page->libWebRTCProvider());
 }
 
index 78be183..690735d 100644 (file)
@@ -310,6 +310,10 @@ Page::Page(PageConfiguration&& pageConfiguration)
 #if PLATFORM(COCOA)
     platformInitialize();
 #endif
+
+#if USE(LIBWEBRTC)
+    m_libWebRTCProvider->supportsVP8(RuntimeEnabledFeatures::sharedFeatures().webRTCVP8CodecEnabled());
+#endif
 }
 
 Page::~Page()
index a31bd6a..0faf695 100644 (file)
@@ -113,6 +113,8 @@ public:
     Optional<RTCRtpCapabilities> receiverCapabilities(const String& kind);
     Optional<RTCRtpCapabilities> senderCapabilities(const String& kind);
 
+    void clearFactory() { m_factory = nullptr; }
+
 protected:
     LibWebRTCProvider() = default;
 
index ff35c56..b965968 100644 (file)
@@ -1463,6 +1463,14 @@ void Internals::stopPeerConnection(RTCPeerConnection& connection)
     object.stop();
 }
 
+void Internals::clearPeerConnectionFactory()
+{
+#if USE(LIBWEBRTC)
+    if (auto* page = contextDocument()->page())
+        page->libWebRTCProvider().clearFactory();
+#endif
+}
+
 void Internals::applyRotationForOutgoingVideoSources(RTCPeerConnection& connection)
 {
     connection.applyRotationForOutgoingVideoSources();
index 5a2ccdb..1151ef2 100644 (file)
@@ -518,6 +518,7 @@ public:
     void setICECandidateFiltering(bool);
     void setEnumeratingAllNetworkInterfacesEnabled(bool);
     void stopPeerConnection(RTCPeerConnection&);
+    void clearPeerConnectionFactory();
     void applyRotationForOutgoingVideoSources(RTCPeerConnection&);
 #endif
 
index df16b5f..f56ad64 100644 (file)
@@ -583,6 +583,7 @@ enum CompositingPolicy {
     [Conditional=WEB_RTC] void setICECandidateFiltering(boolean enabled);
     [Conditional=WEB_RTC] void setEnumeratingAllNetworkInterfacesEnabled(boolean enabled);
     [Conditional=WEB_RTC] void stopPeerConnection(RTCPeerConnection connection);
+    [Conditional=WEB_RTC] void clearPeerConnectionFactory();
 
     [Conditional=VIDEO] void simulateSystemSleep();
     [Conditional=VIDEO] void simulateSystemWake();