[WebRTC] Provide default implementation of LibWebRTCProvider
authorross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 03:57:23 +0000 (03:57 +0000)
committerross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 03:57:23 +0000 (03:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191611

Reviewed by Michael Catanzaro.

Refactor LibWebRTCProvider such that platform-specific implementations need not worry about specifying defaults.

* PlatformWin.cmake:
* platform/GStreamer.cmake:
* platform/SourcesGLib.txt:
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
* platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp.
* platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h.
* platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp: Removed.

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

Source/WebCore/ChangeLog
Source/WebCore/PlatformWin.cmake
Source/WebCore/platform/GStreamer.cmake
Source/WebCore/platform/SourcesGLib.txt
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp [moved from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp with 79% similarity]
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.h [moved from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h with 90% similarity]
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp [deleted file]

index e8a8432..b807598 100644 (file)
@@ -1,3 +1,21 @@
+2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [WebRTC] Provide default implementation of LibWebRTCProvider
+        https://bugs.webkit.org/show_bug.cgi?id=191611
+
+        Reviewed by Michael Catanzaro.
+
+        Refactor LibWebRTCProvider such that platform-specific implementations need not worry about specifying defaults.
+
+        * PlatformWin.cmake:
+        * platform/GStreamer.cmake:
+        * platform/SourcesGLib.txt:
+        * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
+        * platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp.
+        * platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.h: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h.
+        * platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp: Removed.
+
 2018-11-13  Timothy Hatcher  <timothy@apple.com>
 
         Use a light scrollbar for transparent web views in dark mode.
index 5d39f6d..1930ebc 100644 (file)
@@ -71,8 +71,6 @@ list(APPEND WebCore_SOURCES
     platform/graphics/win/TransformationMatrixWin.cpp
     platform/graphics/win/UniscribeController.cpp
 
-    platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp
-
     platform/network/win/DownloadBundleWin.cpp
     platform/network/win/NetworkStateNotifierWin.cpp
 
index d53544a..6a0e033 100644 (file)
@@ -37,6 +37,7 @@ if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
         platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp
         platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp
         platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp
+        platform/mediastream/libwebrtc/LibWebRTCProviderGStreamer.cpp
 
         platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp
         platform/mediastream/gstreamer/GStreamerAudioCapturer.cpp
index 54c9837..2773c2a 100644 (file)
@@ -33,5 +33,3 @@ platform/glib/SharedBufferGlib.cpp
 platform/glib/UserAgentGLib.cpp
 
 platform/network/glib/NetworkStateNotifierGLib.cpp
-
-platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp
index edc70eb..e5dab66 100644 (file)
@@ -52,11 +52,16 @@ ALLOW_UNUSED_PARAMETERS_END
 
 namespace WebCore {
 
-#if !PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(WPE)
+#if !USE(LIBWEBRTC)
 UniqueRef<LibWebRTCProvider> LibWebRTCProvider::create()
 {
     return makeUniqueRef<LibWebRTCProvider>();
 }
+
+bool LibWebRTCProvider::webRTCAvailable()
+{
+    return false;
+}
 #endif
 
 void LibWebRTCProvider::setActive(bool)
index 03d7366..1a4d3e6 100644 (file)
 #include "LibWebRTCProviderCocoa.h"
 
 #if USE(LIBWEBRTC)
+
 #include <webrtc/media/engine/webrtcvideodecoderfactory.h>
 #include <webrtc/media/engine/webrtcvideoencoderfactory.h>
 #include <webrtc/sdk/WebKit/WebKitUtilities.h>
 #include <wtf/darwin/WeakLinking.h>
-#endif
 
 namespace WebCore {
 
 UniqueRef<LibWebRTCProvider> LibWebRTCProvider::create()
 {
-#if USE(LIBWEBRTC) && PLATFORM(COCOA)
     return makeUniqueRef<LibWebRTCProviderCocoa>();
-#else
-    return makeUniqueRef<LibWebRTCProvider>();
-#endif
 }
 
-#if USE(LIBWEBRTC)
-
 LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa()
 {
 }
@@ -72,15 +66,11 @@ void LibWebRTCProviderCocoa::setActive(bool value)
     webrtc::setApplicationStatus(value);
 }
 
-#endif // USE(LIBWEBRTC)
-
 bool LibWebRTCProvider::webRTCAvailable()
 {
-#if USE(LIBWEBRTC)
     return !isNullFunctionPointer(rtc::LogMessage::LogToDebug);
-#else
-    return true;
-#endif
 }
 
 } // namespace WebCore
+
+#endif // USE(LIBWEBRTC)
@@ -24,7 +24,9 @@
  */
 
 #include "config.h"
-#include "LibWebRTCProviderGlib.h"
+#include "LibWebRTCProviderGStreamer.h"
+
+#if USE(LIBWEBRTC) && USE(GSTREAMER)
 
 #include <wtf/UniqueRef.h>
 
@@ -32,32 +34,24 @@ namespace WebCore {
 
 UniqueRef<LibWebRTCProvider> LibWebRTCProvider::create()
 {
-#if USE(LIBWEBRTC) && (PLATFORM(GTK) || PLATFORM(WPE))
-    return makeUniqueRef<LibWebRTCProviderGlib>();
-#else
-    return makeUniqueRef<LibWebRTCProvider>();
-#endif
+    return makeUniqueRef<LibWebRTCProviderGStreamer>();
 }
 
 bool LibWebRTCProvider::webRTCAvailable()
 {
-#if USE(LIBWEBRTC) && USE(GSTREAMER)
     return true;
-#else
-    return false;
-#endif
 }
 
-#if USE(LIBWEBRTC) && USE(GSTREAMER)
-std::unique_ptr<webrtc::VideoDecoderFactory> LibWebRTCProviderGlib::createDecoderFactory()
+std::unique_ptr<webrtc::VideoDecoderFactory> LibWebRTCProviderGStreamer::createDecoderFactory()
 {
     return std::make_unique<GStreamerVideoDecoderFactory>();
 }
 
-std::unique_ptr<webrtc::VideoEncoderFactory> LibWebRTCProviderGlib::createEncoderFactory()
+std::unique_ptr<webrtc::VideoEncoderFactory> LibWebRTCProviderGStreamer::createEncoderFactory()
 {
     return std::make_unique<GStreamerVideoEncoderFactory>();
 }
-#endif // USE(LIBWEBRTC) && USE(GSTREAMER)
 
 } // namespace WebCore
+
+#endif // USE(LIBWEBRTC) && USE(GSTREAMER)
 
 #pragma once
 
-#if USE(GSTREAMER)
-#include "GStreamerVideoDecoderFactory.h"
-#include "GStreamerVideoEncoderFactory.h"
-#endif
-
 #include "LibWebRTCProvider.h"
 
-#if USE(LIBWEBRTC)
+#if USE(LIBWEBRTC) && USE(GSTREAMER)
+
+#include "GStreamerVideoDecoderFactory.h"
+#include "GStreamerVideoEncoderFactory.h"
 
 namespace WebCore {
 
-class WEBCORE_EXPORT LibWebRTCProviderGlib : public LibWebRTCProvider {
+class WEBCORE_EXPORT LibWebRTCProviderGStreamer : public LibWebRTCProvider {
 public:
-    LibWebRTCProviderGlib() = default;
+    LibWebRTCProviderGStreamer() = default;
 
-#if USE(GSTREAMER)
     std::unique_ptr<webrtc::VideoEncoderFactory> createEncoderFactory() final;
     std::unique_ptr<webrtc::VideoDecoderFactory> createDecoderFactory() final;
-#endif
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp
deleted file mode 100644 (file)
index b4c5ef0..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2018 Sony Interactive Entertainment Inc.
- *
- * 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 "LibWebRTCProvider.h"
-
-namespace WebCore {
-
-bool LibWebRTCProvider::webRTCAvailable()
-{
-    return false;
-}
-
-} // namespace WebCore