Make LibWebRTCProvider port agnostic
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2017 07:44:35 +0000 (07:44 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2017 07:44:35 +0000 (07:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177747

Patch by Youenn Fablet <youenn@apple.com> on 2017-10-05
Reviewed by Alex Christensen & Alex Garcia.

Source/WebCore:

No change of behavior.

LibWebRTCProvider had some Mac/iOS specific members that are now
moved to LibWebRTCProviderCocoa.
This consists in the codec factories that are VideoToolBox specific.
Introducing LibWebRTCProvider::create to allow different port implementations of LibWebRTCProvider.

* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::overlayPage):
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::create):
(WebCore::LibWebRTCProvider::factory):
(WebCore::LibWebRTCProvider::createPeerConnectionFactory):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
(WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
(WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
(WebCore::LibWebRTCProviderCocoa::setActive):
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):

Source/WebKit:

* WebProcess/Network/webrtc/LibWebRTCProvider.h: Making sure Mac/iOS provider creates the codec factories.

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):

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

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp [new file with mode: 0644]
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h [new file with mode: 0644]
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebView.mm

index da12e13..0e57437 100644 (file)
@@ -1,3 +1,33 @@
+2017-10-05  Youenn Fablet  <youenn@apple.com>
+
+        Make LibWebRTCProvider port agnostic
+        https://bugs.webkit.org/show_bug.cgi?id=177747
+
+        Reviewed by Alex Christensen & Alex Garcia.
+
+        No change of behavior.
+
+        LibWebRTCProvider had some Mac/iOS specific members that are now
+        moved to LibWebRTCProviderCocoa.
+        This consists in the codec factories that are VideoToolBox specific.
+        Introducing LibWebRTCProvider::create to allow different port implementations of LibWebRTCProvider.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::overlayPage):
+        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+        (WebCore::LibWebRTCProvider::create):
+        (WebCore::LibWebRTCProvider::factory):
+        (WebCore::LibWebRTCProvider::createPeerConnectionFactory):
+        * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
+        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
+        (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
+        (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
+        (WebCore::LibWebRTCProviderCocoa::setActive):
+        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::dataChanged):
+
 2017-10-04  Alex Christensen  <achristensen@webkit.org>
 
         Remove WebCoreSystemInterface
index da05d75..6f8688b 100644 (file)
                41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 41AD75391CEF6BCE00A31486 /* FetchOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41B28B141F8501A600FB52AC /* MediaEndpointConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41B28B131F8501A400FB52AC /* MediaEndpointConfiguration.cpp */; };
                41B28B151F8501D300FB52AC /* MediaEndpointConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B28B121F8501A300FB52AC /* MediaEndpointConfiguration.h */; };
+               41B28B391F860BD600FB52AC /* LibWebRTCProviderCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41B28B381F860BD100FB52AC /* LibWebRTCProviderCocoa.cpp */; };
+               41B28B3D1F860EF300FB52AC /* LibWebRTCProviderCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B28B361F860BD000FB52AC /* LibWebRTCProviderCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41B2A6261EF1BF6D002B9D7A /* WebAudioSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B2A6251EF1BF60002B9D7A /* WebAudioSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41B459EF1F55EBD10000F6FD /* ReadableStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41B459ED1F55EBC70000F6FD /* ReadableStream.cpp */; };
                41BF700C0FE86F49005E8DEC /* MessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
                41AD75391CEF6BCE00A31486 /* FetchOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchOptions.h; sourceTree = "<group>"; };
                41B28B121F8501A300FB52AC /* MediaEndpointConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaEndpointConfiguration.h; sourceTree = "<group>"; };
                41B28B131F8501A400FB52AC /* MediaEndpointConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaEndpointConfiguration.cpp; sourceTree = "<group>"; };
+               41B28B361F860BD000FB52AC /* LibWebRTCProviderCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCProviderCocoa.h; path = libwebrtc/LibWebRTCProviderCocoa.h; sourceTree = "<group>"; };
+               41B28B381F860BD100FB52AC /* LibWebRTCProviderCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCProviderCocoa.cpp; path = libwebrtc/LibWebRTCProviderCocoa.cpp; sourceTree = "<group>"; };
                41B2A6251EF1BF60002B9D7A /* WebAudioSourceProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebAudioSourceProvider.h; sourceTree = "<group>"; };
                41B459DA1F4CADB90000F6FD /* ReadableStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStream.h; sourceTree = "<group>"; };
                41B459ED1F55EBC70000F6FD /* ReadableStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReadableStream.cpp; sourceTree = "<group>"; };
                                415747431E38699E00E914D8 /* LibWebRTCMacros.h */,
                                41A1B00D1E52656E007F3769 /* LibWebRTCProvider.cpp */,
                                415747441E38699E00E914D8 /* LibWebRTCProvider.h */,
+                               41B28B381F860BD100FB52AC /* LibWebRTCProviderCocoa.cpp */,
+                               41B28B361F860BD000FB52AC /* LibWebRTCProviderCocoa.h */,
                                41D7E5551F73085000E26991 /* VideoToolBoxDecoderFactory.cpp */,
                                41D7E5541F73085000E26991 /* VideoToolBoxDecoderFactory.h */,
                                41CAD71C1EA0905700178164 /* VideoToolBoxEncoderFactory.cpp */,
                                417612B01E3A994000C3D81D /* LibWebRTCMediaEndpoint.h in Headers */,
                                417612B21E3A994000C3D81D /* LibWebRTCPeerConnectionBackend.h in Headers */,
                                415747481E3869A700E914D8 /* LibWebRTCProvider.h in Headers */,
+                               41B28B3D1F860EF300FB52AC /* LibWebRTCProviderCocoa.h in Headers */,
                                84730D911248F0B300D3A9C9 /* LightSource.h in Headers */,
                                B22279650D00BF220071B782 /* LinearGradientAttributes.h in Headers */,
                                AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */,
                                417612AF1E3A994000C3D81D /* LibWebRTCMediaEndpoint.cpp in Sources */,
                                417612B11E3A994000C3D81D /* LibWebRTCPeerConnectionBackend.cpp in Sources */,
                                41A1B00E1E526579007F3769 /* LibWebRTCProvider.cpp in Sources */,
+                               41B28B391F860BD600FB52AC /* LibWebRTCProviderCocoa.cpp in Sources */,
                                FFB698CC1833EE0D00158A31 /* LineBreaker.cpp in Sources */,
                                FFB698CF183402BB00158A31 /* LineInfo.cpp in Sources */,
                                FFDBC048183D27B700407109 /* LineWidth.cpp in Sources */,
index c8de4b1..997a49f 100644 (file)
@@ -690,7 +690,7 @@ Page* InspectorOverlay::overlayPage()
     PageConfiguration pageConfiguration(
         createEmptyEditorClient(),
         SocketProvider::create(),
-        makeUniqueRef<LibWebRTCProvider>(),
+        LibWebRTCProvider::create(),
         CacheStorageProvider::create()
     );
     fillWithEmptyClients(pageConfiguration);
index 5e5d118..e8b9600 100644 (file)
 #include "config.h"
 #include "LibWebRTCProvider.h"
 
+#if PLATFORM(COCOA)
+#include "LibWebRTCProviderCocoa.h"
+#endif
+
 #if USE(LIBWEBRTC)
 #include "LibWebRTCAudioModule.h"
 #include "Logging.h"
 
 namespace WebCore {
 
+UniqueRef<LibWebRTCProvider> LibWebRTCProvider::create()
+{
+#if USE(LIBWEBRTC) && PLATFORM(COCOA)
+    return makeUniqueRef<LibWebRTCProviderCocoa>();
+#else
+    return makeUniqueRef<LibWebRTCProvider>();
+#endif
+}
+
 #if USE(LIBWEBRTC)
 struct PeerConnectionFactoryAndThreads : public rtc::MessageHandler {
     std::unique_ptr<rtc::Thread> networkThread;
@@ -138,17 +151,16 @@ webrtc::PeerConnectionFactoryInterface* LibWebRTCProvider::factory()
 
     auto& factoryAndThreads = getStaticFactoryAndThreads(m_useNetworkThreadWithSocketServer);
 
-    auto decoderFactory = std::make_unique<VideoToolboxVideoDecoderFactory>();
-    auto encoderFactory = std::make_unique<VideoToolboxVideoEncoderFactory>();
-
-    m_decoderFactory = decoderFactory.get();
-    m_encoderFactory = encoderFactory.get();
-
-    m_factory = webrtc::CreatePeerConnectionFactory(factoryAndThreads.networkThread.get(), factoryAndThreads.networkThread.get(), factoryAndThreads.signalingThread.get(), factoryAndThreads.audioDeviceModule.get(), encoderFactory.release(), decoderFactory.release());
+    m_factory = createPeerConnectionFactory(factoryAndThreads.networkThread.get(), factoryAndThreads.networkThread.get(), factoryAndThreads.audioDeviceModule.get());
 
     return m_factory;
 }
 
+rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> LibWebRTCProvider::createPeerConnectionFactory(rtc::Thread* networkThread, rtc::Thread* signalingThread, LibWebRTCAudioModule* audioModule)
+{
+    return webrtc::CreatePeerConnectionFactory(networkThread, networkThread, signalingThread, audioModule, createEncoderFactory().release(), createDecoderFactory().release());
+}
+
 void LibWebRTCProvider::setPeerConnectionFactory(rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>&& factory)
 {
     m_factory = webrtc::PeerConnectionFactoryProxy::Create(getStaticFactoryAndThreads(m_useNetworkThreadWithSocketServer).signalingThread.get(), WTFMove(factory));
@@ -188,18 +200,6 @@ rtc::scoped_refptr<webrtc::PeerConnectionInterface> LibWebRTCProvider::createPee
 
 #endif // USE(LIBWEBRTC)
 
-void LibWebRTCProvider::setActive(bool value)
-{
-#if USE(LIBWEBRTC)
-    if (m_decoderFactory)
-        m_decoderFactory->setActive(value);
-    if (m_encoderFactory)
-        m_encoderFactory->setActive(value);
-#else
-    UNUSED_PARAM(value);
-#endif
-}
-
 bool LibWebRTCProvider::webRTCAvailable()
 {
 #if USE(LIBWEBRTC)
index 6bc621e..7e52def 100644 (file)
 
 #include "LibWebRTCMacros.h"
 #include <wtf/Forward.h>
+#include <wtf/UniqueRef.h>
 
 #if USE(LIBWEBRTC)
 
 #include <webrtc/api/peerconnectioninterface.h>
 #include <webrtc/base/scoped_ref_ptr.h>
+#include <webrtc/media/engine/webrtcvideodecoderfactory.h>
+#include <webrtc/media/engine/webrtcvideoencoderfactory.h>
 
 namespace rtc {
 class NetworkManager;
 class PacketSocketFactory;
+class Thread;
 }
 
 namespace webrtc {
@@ -45,26 +49,26 @@ class PeerConnectionFactoryInterface;
 
 namespace WebCore {
 
-class VideoToolboxVideoDecoderFactory;
-class VideoToolboxVideoEncoderFactory;
+class LibWebRTCAudioModule;
 
 class WEBCORE_EXPORT LibWebRTCProvider {
 public:
-    LibWebRTCProvider() = default;
+    static UniqueRef<LibWebRTCProvider> create();
+
     virtual ~LibWebRTCProvider() = default;
 
     static bool webRTCAvailable();
 
-    void setActive(bool);
+    virtual void setActive(bool) { };
 
 #if USE(LIBWEBRTC)
-    WEBCORE_EXPORT virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, webrtc::PeerConnectionInterface::RTCConfiguration&&);
+    virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, webrtc::PeerConnectionInterface::RTCConfiguration&&);
 
-    WEBCORE_EXPORT webrtc::PeerConnectionFactoryInterface* factory();
+    webrtc::PeerConnectionFactoryInterface* factory();
 
     // FIXME: Make these methods not static.
-    static WEBCORE_EXPORT void callOnWebRTCNetworkThread(Function<void()>&&);
-    static WEBCORE_EXPORT void callOnWebRTCSignalingThread(Function<void()>&&);
+    static void callOnWebRTCNetworkThread(Function<void()>&&);
+    static void callOnWebRTCSignalingThread(Function<void()>&&);
 
     // Used for mock testing
     void setPeerConnectionFactory(rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>&&);
@@ -73,15 +77,19 @@ public:
     void enableEnumeratingAllNetworkInterfaces() { m_enableEnumeratingAllNetworkInterfaces = true; }
 
 protected:
-    WEBCORE_EXPORT rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, rtc::NetworkManager&, rtc::PacketSocketFactory&, webrtc::PeerConnectionInterface::RTCConfiguration&&);
+    LibWebRTCProvider() = default;
+
+    rtc::scoped_refptr<webrtc::PeerConnectionInterface> createPeerConnection(webrtc::PeerConnectionObserver&, rtc::NetworkManager&, rtc::PacketSocketFactory&, webrtc::PeerConnectionInterface::RTCConfiguration&&);
+
+    rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> createPeerConnectionFactory(rtc::Thread* networkThread, rtc::Thread* signalingThread, LibWebRTCAudioModule*);
+    virtual std::unique_ptr<cricket::WebRtcVideoDecoderFactory> createDecoderFactory() { return nullptr; }
+    virtual std::unique_ptr<cricket::WebRtcVideoEncoderFactory> createEncoderFactory() { return nullptr; }
 
     bool m_enableEnumeratingAllNetworkInterfaces { false };
     // FIXME: Remove m_useNetworkThreadWithSocketServer member variable and make it a global.
     bool m_useNetworkThreadWithSocketServer { true };
 
     rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> m_factory;
-    VideoToolboxVideoDecoderFactory* m_decoderFactory { nullptr };
-    VideoToolboxVideoEncoderFactory* m_encoderFactory { nullptr };
 #endif
 };
 
diff --git a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp
new file mode 100644 (file)
index 0000000..6795a30
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LibWebRTCProviderCocoa.h"
+
+#if USE(LIBWEBRTC)
+
+#include "VideoToolBoxDecoderFactory.h"
+#include "VideoToolBoxEncoderFactory.h"
+
+namespace WebCore {
+
+std::unique_ptr<cricket::WebRtcVideoDecoderFactory> LibWebRTCProviderCocoa::createDecoderFactory()
+{
+    ASSERT(!m_decoderFactory);
+    auto decoderFactory = std::make_unique<VideoToolboxVideoDecoderFactory>();
+    m_decoderFactory = decoderFactory.get();
+
+    return WTFMove(decoderFactory);
+}
+
+std::unique_ptr<cricket::WebRtcVideoEncoderFactory> LibWebRTCProviderCocoa::createEncoderFactory()
+{
+    ASSERT(!m_encoderFactory);
+    auto encoderFactory = std::make_unique<VideoToolboxVideoEncoderFactory>();
+    m_encoderFactory = encoderFactory.get();
+
+    return WTFMove(encoderFactory);
+}
+
+void LibWebRTCProviderCocoa::setActive(bool value)
+{
+    if (m_decoderFactory)
+        m_decoderFactory->setActive(value);
+    if (m_encoderFactory)
+        m_encoderFactory->setActive(value);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h
new file mode 100644 (file)
index 0000000..ec56052
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "LibWebRTCProvider.h"
+
+#if USE(LIBWEBRTC)
+
+namespace WebCore {
+
+class VideoToolboxVideoDecoderFactory;
+class VideoToolboxVideoEncoderFactory;
+
+class WEBCORE_EXPORT LibWebRTCProviderCocoa : public LibWebRTCProvider {
+public:
+    LibWebRTCProviderCocoa() = default;
+
+private:
+    void setActive(bool) final;
+    std::unique_ptr<cricket::WebRtcVideoDecoderFactory> createDecoderFactory() final;
+    std::unique_ptr<cricket::WebRtcVideoEncoderFactory> createEncoderFactory() final;
+
+    VideoToolboxVideoDecoderFactory* m_decoderFactory { nullptr };
+    VideoToolboxVideoEncoderFactory* m_encoderFactory { nullptr };
+};
+
+} // namespace WebCore
+
+#endif
index 426e25e..1345f9e 100644 (file)
@@ -428,7 +428,7 @@ EncodedDataStatus SVGImage::dataChanged(bool allDataReceived)
         PageConfiguration pageConfiguration(
             createEmptyEditorClient(),
             SocketProvider::create(),
-            makeUniqueRef<LibWebRTCProvider>(),
+            LibWebRTCProvider::create(),
             CacheStorageProvider::create()
         );
         fillWithEmptyClients(pageConfiguration);
index f2662f4..f0879c5 100644 (file)
@@ -1,3 +1,12 @@
+2017-10-05  Youenn Fablet  <youenn@apple.com>
+
+        Make LibWebRTCProvider port agnostic
+        https://bugs.webkit.org/show_bug.cgi?id=177747
+
+        Reviewed by Alex Christensen & Alex Garcia.
+
+        * WebProcess/Network/webrtc/LibWebRTCProvider.h: Making sure Mac/iOS provider creates the codec factories.
+
 2017-10-04  Alex Christensen  <achristensen@webkit.org>
 
         Stop linking with WebKitSystemInterface
index f516b7f..12e66fa 100644 (file)
 
 #pragma once
 
+#if PLATFORM(COCOA)
+#include <WebCore/LibWebRTCProviderCocoa.h>
+#else
 #include <WebCore/LibWebRTCProvider.h>
-
+#endif
 
 namespace WebKit {
 
 #if USE(LIBWEBRTC)
-class LibWebRTCProvider final : public WebCore::LibWebRTCProvider {
+
+#if PLATFORM(COCOA)
+using LibWebRTCProviderBase = WebCore::LibWebRTCProviderCocoa;
+#else
+using LibWebRTCProviderBase = WebCore::LibWebRTCProvider;
+#endif
+
+class LibWebRTCProvider final : public LibWebRTCProviderBase {
 public:
     LibWebRTCProvider() { m_useNetworkThreadWithSocketServer = false; }
 
index a2996b6..93fc54c 100644 (file)
@@ -1,3 +1,14 @@
+2017-10-05  Youenn Fablet  <youenn@apple.com>
+
+        Make LibWebRTCProvider port agnostic
+        https://bugs.webkit.org/show_bug.cgi?id=177747
+
+        Reviewed by Alex Christensen & Alex Garcia.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+
 2017-10-04  Alex Christensen  <achristensen@webkit.org>
 
         Stop linking with WebKitSystemInterface
index b69698d..799d9e2 100644 (file)
@@ -1415,7 +1415,7 @@ static void WebKitInitializeGamepadProviderIfNecessary()
     PageConfiguration pageConfiguration(
         makeUniqueRef<WebEditorClient>(self),
         SocketProvider::create(),
-        makeUniqueRef<WebCore::LibWebRTCProvider>(),
+        LibWebRTCProvider::create(),
         WebCore::CacheStorageProvider::create()
     );
 #if !PLATFORM(IOS)
@@ -1679,7 +1679,7 @@ static void WebKitInitializeGamepadProviderIfNecessary()
     PageConfiguration pageConfiguration(
         makeUniqueRef<WebEditorClient>(self),
         SocketProvider::create(),
-        makeUniqueRef<WebCore::LibWebRTCProvider>(),
+        LibWebRTCProvider::create(),
         WebCore::CacheStorageProvider::create()
     );
     pageConfiguration.chromeClient = new WebChromeClientIOS(self);