Remove derived classes of RealtimeMediaSourceCenter
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2018 03:46:19 +0000 (03:46 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2018 03:46:19 +0000 (03:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192546

Reviewed by Eric Carlson.

Source/WebCore:

Remove virtual methods of RealtimeMediaSourceCenter and remove derived classes of it.
Instead port specific implementation directly implement the needed default factory methods.

Renamed some methods for improved consistency.
Moved some static variables as RealtimeMediaSourceCenter members.

No change of behavior.

* WebCore.xcodeproj/project.pbxproj:
* page/DeprecatedGlobalSettings.cpp:
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::createMediaStream):
(WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
(WebCore::RealtimeMediaSourceCenter::getUserMediaDevices):
(WebCore::RealtimeMediaSourceCenter::setVideoCapturePageState):
(WebCore::RealtimeMediaSourceCenter::setAudioFactory):
(WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
(WebCore::RealtimeMediaSourceCenter::audioCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::setVideoFactory):
(WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
(WebCore::RealtimeMediaSourceCenter::videoCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::setDisplayCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::unsetDisplayCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::displayCaptureFactory):
* platform/mediastream/RealtimeMediaSourceCenter.h:
* platform/mediastream/RealtimeVideoSource.cpp:
(WebCore::RealtimeVideoSource::~RealtimeVideoSource):
(WebCore::RealtimeVideoSource::prepareToProduceData):
* platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
(WebCore::RealtimeMediaSourceCenter::singleton):
(WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
* platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h: Removed.
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
(WebCore::AVVideoCaptureSource::setupCaptureSession):
* platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
(WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
(WebCore::DisplayCaptureSourceCocoa::startProducingData):
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenter::singleton):
(WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
(WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: Removed.
* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
(WebCore::MockRealtimeAudioSource::startProducingData):
* platform/mock/MockRealtimeMediaSourceCenter.cpp:
(WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
(WebCore::MockRealtimeMediaSourceCenter::audioCaptureFactory):
(WebCore::MockRealtimeMediaSourceCenter::videoCaptureFactory):
* platform/mock/MockRealtimeMediaSourceCenter.h:

Source/WebKit:

pdate code according WebCore changes.

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::~UserMediaCaptureManager):
(WebKit::UserMediaCaptureManager::initialize):

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

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/DeprecatedGlobalSettings.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h
Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp
Source/WebCore/platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp
Source/WebCore/platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h [deleted file]
Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
Source/WebCore/platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp
Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp
Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.h [deleted file]
Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp
Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp
Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp

index a7fb202..81dae6f 100644 (file)
@@ -1,5 +1,67 @@
 2018-12-10  Youenn Fablet  <youenn@apple.com>
 
+        Remove derived classes of RealtimeMediaSourceCenter
+        https://bugs.webkit.org/show_bug.cgi?id=192546
+
+        Reviewed by Eric Carlson.
+
+        Remove virtual methods of RealtimeMediaSourceCenter and remove derived classes of it.
+        Instead port specific implementation directly implement the needed default factory methods.
+
+        Renamed some methods for improved consistency.
+        Moved some static variables as RealtimeMediaSourceCenter members.
+
+        No change of behavior.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/DeprecatedGlobalSettings.cpp:
+        * platform/mediastream/RealtimeMediaSourceCenter.cpp:
+        (WebCore::RealtimeMediaSourceCenter::createMediaStream):
+        (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
+        (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices):
+        (WebCore::RealtimeMediaSourceCenter::setVideoCapturePageState):
+        (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
+        (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
+        (WebCore::RealtimeMediaSourceCenter::audioCaptureFactory):
+        (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
+        (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
+        (WebCore::RealtimeMediaSourceCenter::videoCaptureFactory):
+        (WebCore::RealtimeMediaSourceCenter::setDisplayCaptureFactory):
+        (WebCore::RealtimeMediaSourceCenter::unsetDisplayCaptureFactory):
+        (WebCore::RealtimeMediaSourceCenter::displayCaptureFactory):
+        * platform/mediastream/RealtimeMediaSourceCenter.h:
+        * platform/mediastream/RealtimeVideoSource.cpp:
+        (WebCore::RealtimeVideoSource::~RealtimeVideoSource):
+        (WebCore::RealtimeVideoSource::prepareToProduceData):
+        * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
+        (WebCore::RealtimeMediaSourceCenter::singleton):
+        (WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
+        (WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
+        (WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
+        * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h: Removed.
+        * platform/mediastream/mac/AVVideoCaptureSource.mm:
+        (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
+        (WebCore::AVVideoCaptureSource::setupCaptureSession):
+        * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
+        (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
+        (WebCore::DisplayCaptureSourceCocoa::startProducingData):
+        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
+        (WebCore::RealtimeMediaSourceCenter::singleton):
+        (WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
+        (WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
+        (WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
+        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: Removed.
+        * platform/mock/MockRealtimeAudioSource.cpp:
+        (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
+        (WebCore::MockRealtimeAudioSource::startProducingData):
+        * platform/mock/MockRealtimeMediaSourceCenter.cpp:
+        (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
+        (WebCore::MockRealtimeMediaSourceCenter::audioCaptureFactory):
+        (WebCore::MockRealtimeMediaSourceCenter::videoCaptureFactory):
+        * platform/mock/MockRealtimeMediaSourceCenter.h:
+
+2018-12-10  Youenn Fablet  <youenn@apple.com>
+
         DataChannels created asynchronously never open and are unusable
         https://bugs.webkit.org/show_bug.cgi?id=192566
 
index 5f6c730..df2c955 100644 (file)
                4A0DA2FF129B241900AB61E1 /* FormAssociatedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A0DA2FD129B241900AB61E1 /* FormAssociatedElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4A0FFA9E1AAF5E7E0062803B /* MockRealtimeMediaSourceCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A0FFA9C1AAF5E6C0062803B /* MockRealtimeMediaSourceCenter.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4A0FFAA21AAF5EA20062803B /* RealtimeMediaSourceCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A0FFAA01AAF5EA20062803B /* RealtimeMediaSourceCenter.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               4A0FFAA61AAF5EF60062803B /* RealtimeMediaSourceCenterMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A0FFAA41AAF5EF60062803B /* RealtimeMediaSourceCenterMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4A38BF5114FE1C0900612512 /* WebSocketDeflateFramer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A38BF4F14FE1C0900612512 /* WebSocketDeflateFramer.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4A4F48AA16B0DFC000EDBB29 /* DocumentRuleSets.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A4F48A816B0DFC000EDBB29 /* DocumentRuleSets.h */; };
                4A4F65711AA997F100E38CDD /* RealtimeMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A4F656C1AA997F100E38CDD /* RealtimeMediaSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4A0FFA9F1AAF5EA20062803B /* RealtimeMediaSourceCenter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeMediaSourceCenter.cpp; sourceTree = "<group>"; };
                4A0FFAA01AAF5EA20062803B /* RealtimeMediaSourceCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtimeMediaSourceCenter.h; sourceTree = "<group>"; };
                4A0FFAA31AAF5EF60062803B /* RealtimeMediaSourceCenterMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeMediaSourceCenterMac.cpp; sourceTree = "<group>"; };
-               4A0FFAA41AAF5EF60062803B /* RealtimeMediaSourceCenterMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtimeMediaSourceCenterMac.h; sourceTree = "<group>"; };
                4A38BF4E14FE1C0900612512 /* WebSocketDeflateFramer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketDeflateFramer.cpp; sourceTree = "<group>"; };
                4A38BF4F14FE1C0900612512 /* WebSocketDeflateFramer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketDeflateFramer.h; sourceTree = "<group>"; };
                4A4F48A716B0DFC000EDBB29 /* DocumentRuleSets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentRuleSets.cpp; sourceTree = "<group>"; };
                                5CDD833A1E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.h */,
                                5CDD83391E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.mm */,
                                4A0FFAA31AAF5EF60062803B /* RealtimeMediaSourceCenterMac.cpp */,
-                               4A0FFAA41AAF5EF60062803B /* RealtimeMediaSourceCenterMac.h */,
                                41103AA71E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.cpp */,
                                41103AA81E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.h */,
                                5CDD833B1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.cpp */,
                                4A4F65711AA997F100E38CDD /* RealtimeMediaSource.h in Headers */,
                                4A4F65721AA997F100E38CDD /* RealtimeMediaSourceCapabilities.h in Headers */,
                                4A0FFAA21AAF5EA20062803B /* RealtimeMediaSourceCenter.h in Headers */,
-                               4A0FFAA61AAF5EF60062803B /* RealtimeMediaSourceCenterMac.h in Headers */,
                                0754A5EA215EA3B8002D3A99 /* RealtimeMediaSourceFactory.h in Headers */,
                                4A4F65741AA997F100E38CDD /* RealtimeMediaSourceSettings.h in Headers */,
                                07C1C0E51BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h in Headers */,
index f350b46..f4995d3 100644 (file)
@@ -34,9 +34,6 @@
 #if ENABLE(MEDIA_STREAM)
 #include "MockRealtimeMediaSourceCenter.h"
 
-#if USE(AVFOUNDATION)
-#include "RealtimeMediaSourceCenterMac.h"
-#endif
 #endif
 
 namespace WebCore {
index d67e127..290b311 100644 (file)
 
 namespace WebCore {
 
-
 RealtimeMediaSourceCenter& RealtimeMediaSourceCenter::singleton()
 {
-    return RealtimeMediaSourceCenter::platformCenter();
+    ASSERT(isMainThread());
+    static NeverDestroyed<RealtimeMediaSourceCenter> center;
+    return center;
 }
 
 RealtimeMediaSourceCenter::RealtimeMediaSourceCenter()
@@ -68,7 +69,7 @@ void RealtimeMediaSourceCenter::createMediaStream(NewMediaStreamHandler&& comple
     String invalidConstraint;
 
     if (audioDevice) {
-        auto audioSource = audioFactory().createAudioCaptureSource(WTFMove(audioDevice), String { hashSalt }, &request.audioConstraints);
+        auto audioSource = audioCaptureFactory().createAudioCaptureSource(WTFMove(audioDevice), String { hashSalt }, &request.audioConstraints);
         if (audioSource)
             audioSources.append(audioSource.source());
         else {
@@ -84,7 +85,7 @@ void RealtimeMediaSourceCenter::createMediaStream(NewMediaStreamHandler&& comple
     if (videoDevice) {
         CaptureSourceOrError videoSource;
         if (videoDevice.type() == CaptureDevice::DeviceType::Camera)
-            videoSource = videoFactory().createVideoCaptureSource(WTFMove(videoDevice), WTFMove(hashSalt), &request.videoConstraints);
+            videoSource = videoCaptureFactory().createVideoCaptureSource(WTFMove(videoDevice), WTFMove(hashSalt), &request.videoConstraints);
         else
             videoSource = displayCaptureFactory().createDisplayCaptureSource(WTFMove(videoDevice), &request.videoConstraints);
 
@@ -106,11 +107,11 @@ void RealtimeMediaSourceCenter::createMediaStream(NewMediaStreamHandler&& comple
 Vector<CaptureDevice> RealtimeMediaSourceCenter::getMediaStreamDevices()
 {
     Vector<CaptureDevice> result;
-    for (auto& device : audioFactory().audioCaptureDeviceManager().captureDevices()) {
+    for (auto& device : audioCaptureFactory().audioCaptureDeviceManager().captureDevices()) {
         if (device.enabled())
             result.append(device);
     }
-    for (auto& device : videoFactory().videoCaptureDeviceManager().captureDevices()) {
+    for (auto& device : videoCaptureFactory().videoCaptureDeviceManager().captureDevices()) {
         if (device.enabled())
             result.append(device);
     }
@@ -191,11 +192,11 @@ void RealtimeMediaSourceCenter::getUserMediaDevices(const MediaStreamRequest& re
 {
     String invalidConstraint;
     if (request.audioConstraints.isValid) {
-        for (auto& device : audioFactory().audioCaptureDeviceManager().captureDevices()) {
+        for (auto& device : audioCaptureFactory().audioCaptureDeviceManager().captureDevices()) {
             if (!device.enabled())
                 continue;
 
-            auto sourceOrError = audioFactory().createAudioCaptureSource(device, String { hashSalt }, { });
+            auto sourceOrError = audioCaptureFactory().createAudioCaptureSource(device, String { hashSalt }, { });
             if (sourceOrError && sourceOrError.captureSource->supportsConstraints(request.audioConstraints, invalidConstraint))
                 audioDeviceInfo.append({sourceOrError.captureSource->fitnessScore(), device});
 
@@ -205,11 +206,11 @@ void RealtimeMediaSourceCenter::getUserMediaDevices(const MediaStreamRequest& re
     }
 
     if (request.videoConstraints.isValid) {
-        for (auto& device : videoFactory().videoCaptureDeviceManager().captureDevices()) {
+        for (auto& device : videoCaptureFactory().videoCaptureDeviceManager().captureDevices()) {
             if (!device.enabled())
                 continue;
 
-            auto sourceOrError = videoFactory().createVideoCaptureSource(device, String { hashSalt }, { });
+            auto sourceOrError = videoCaptureFactory().createVideoCaptureSource(device, String { hashSalt }, { });
             if (sourceOrError && sourceOrError.captureSource->supportsConstraints(request.videoConstraints, invalidConstraint))
                 videoDeviceInfo.append({sourceOrError.captureSource->fitnessScore(), device});
 
@@ -263,81 +264,57 @@ void RealtimeMediaSourceCenter::validateRequestConstraints(ValidConstraintsHandl
 
 void RealtimeMediaSourceCenter::setVideoCapturePageState(bool interrupted, bool pageMuted)
 {
-    videoFactory().setVideoCapturePageState(interrupted, pageMuted);
+    videoCaptureFactory().setVideoCapturePageState(interrupted, pageMuted);
 }
 
-std::optional<CaptureDevice> RealtimeMediaSourceCenter::captureDeviceWithPersistentID(CaptureDevice::DeviceType type, const String& id)
+void RealtimeMediaSourceCenter::setAudioCaptureFactory(AudioCaptureFactory& factory)
 {
-    switch (type) {
-    case CaptureDevice::DeviceType::Camera:
-        return videoFactory().videoCaptureDeviceManager().captureDeviceWithPersistentID(type, id);
-        break;
-    case CaptureDevice::DeviceType::Microphone:
-        return audioFactory().audioCaptureDeviceManager().captureDeviceWithPersistentID(type, id);
-        break;
-    case CaptureDevice::DeviceType::Screen:
-    case CaptureDevice::DeviceType::Application:
-    case CaptureDevice::DeviceType::Window:
-    case CaptureDevice::DeviceType::Browser:
-        return displayCaptureFactory().displayCaptureDeviceManager().captureDeviceWithPersistentID(type, id);
-        break;
-    case CaptureDevice::DeviceType::Unknown:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-
-    return std::nullopt;
+    m_audioCaptureFactoryOverride = &factory;
 }
 
-static AudioCaptureFactory* audioFactoryOverride;
-void RealtimeMediaSourceCenter::setAudioFactory(AudioCaptureFactory& factory)
+void RealtimeMediaSourceCenter::unsetAudioCaptureFactory(AudioCaptureFactory& oldOverride)
 {
-    audioFactoryOverride = &factory;
-}
-void RealtimeMediaSourceCenter::unsetAudioFactory(AudioCaptureFactory& oldOverride)
-{
-    ASSERT_UNUSED(oldOverride, audioFactoryOverride == &oldOverride);
-    if (&oldOverride == audioFactoryOverride)
-        audioFactoryOverride = nullptr;
+    ASSERT_UNUSED(oldOverride, m_audioCaptureFactoryOverride == &oldOverride);
+    if (&oldOverride == m_audioCaptureFactoryOverride)
+        m_audioCaptureFactoryOverride = nullptr;
 }
 
-AudioCaptureFactory& RealtimeMediaSourceCenter::audioFactory()
+AudioCaptureFactory& RealtimeMediaSourceCenter::audioCaptureFactory()
 {
-    return audioFactoryOverride ? *audioFactoryOverride : RealtimeMediaSourceCenter::singleton().audioFactoryPrivate();
+    return m_audioCaptureFactoryOverride ? *m_audioCaptureFactoryOverride : defaultAudioCaptureFactory();
 }
 
-static VideoCaptureFactory* videoFactoryOverride;
-void RealtimeMediaSourceCenter::setVideoFactory(VideoCaptureFactory& factory)
+void RealtimeMediaSourceCenter::setVideoCaptureFactory(VideoCaptureFactory& factory)
 {
-    videoFactoryOverride = &factory;
+    m_videoCaptureFactoryOverride = &factory;
 }
-void RealtimeMediaSourceCenter::unsetVideoFactory(VideoCaptureFactory& oldOverride)
+void RealtimeMediaSourceCenter::unsetVideoCaptureFactory(VideoCaptureFactory& oldOverride)
 {
-    ASSERT_UNUSED(oldOverride, videoFactoryOverride == &oldOverride);
-    if (&oldOverride == videoFactoryOverride)
-        videoFactoryOverride = nullptr;
+    ASSERT_UNUSED(oldOverride, m_videoCaptureFactoryOverride == &oldOverride);
+    if (&oldOverride == m_videoCaptureFactoryOverride)
+        m_videoCaptureFactoryOverride = nullptr;
 }
 
-VideoCaptureFactory& RealtimeMediaSourceCenter::videoFactory()
+VideoCaptureFactory& RealtimeMediaSourceCenter::videoCaptureFactory()
 {
-    return videoFactoryOverride ? *videoFactoryOverride : RealtimeMediaSourceCenter::singleton().videoFactoryPrivate();
+    return m_videoCaptureFactoryOverride ? *m_videoCaptureFactoryOverride : defaultVideoCaptureFactory();
 }
 
-static DisplayCaptureFactory* displayCaptureFactoryOverride;
 void RealtimeMediaSourceCenter::setDisplayCaptureFactory(DisplayCaptureFactory& factory)
 {
-    displayCaptureFactoryOverride = &factory;
+    m_displayCaptureFactoryOverride = &factory;
 }
+
 void RealtimeMediaSourceCenter::unsetDisplayCaptureFactory(DisplayCaptureFactory& oldOverride)
 {
-    ASSERT_UNUSED(oldOverride, displayCaptureFactoryOverride == &oldOverride);
-    if (&oldOverride == displayCaptureFactoryOverride)
-        displayCaptureFactoryOverride = nullptr;
+    ASSERT_UNUSED(oldOverride, m_displayCaptureFactoryOverride == &oldOverride);
+    if (&oldOverride == m_displayCaptureFactoryOverride)
+        m_displayCaptureFactoryOverride = nullptr;
 }
 
 DisplayCaptureFactory& RealtimeMediaSourceCenter::displayCaptureFactory()
 {
-    return displayCaptureFactoryOverride ? *displayCaptureFactoryOverride : RealtimeMediaSourceCenter::singleton().displayCaptureFactoryPrivate();
+    return m_displayCaptureFactoryOverride ? *m_displayCaptureFactoryOverride : defaultDisplayCaptureFactory();
 }
 
 } // namespace WebCore
index bb0def2..3bb2594 100644 (file)
@@ -55,34 +55,32 @@ struct MediaConstraints;
     
 class RealtimeMediaSourceCenter {
 public:
-    static RealtimeMediaSourceCenter& platformCenter();
-    virtual ~RealtimeMediaSourceCenter();
+    ~RealtimeMediaSourceCenter();
 
     WEBCORE_EXPORT static RealtimeMediaSourceCenter& singleton();
 
     using ValidConstraintsHandler = WTF::Function<void(Vector<CaptureDevice>&& audioDeviceUIDs, Vector<CaptureDevice>&& videoDeviceUIDs, String&&)>;
     using InvalidConstraintsHandler = WTF::Function<void(const String& invalidConstraint)>;
-    virtual void validateRequestConstraints(ValidConstraintsHandler&&, InvalidConstraintsHandler&&, const MediaStreamRequest&, String&&);
+    WEBCORE_EXPORT void validateRequestConstraints(ValidConstraintsHandler&&, InvalidConstraintsHandler&&, const MediaStreamRequest&, String&&);
 
     using NewMediaStreamHandler = WTF::Function<void(RefPtr<MediaStreamPrivate>&&)>;
-    virtual void createMediaStream(NewMediaStreamHandler&&, String&&, CaptureDevice&& audioDevice, CaptureDevice&& videoDevice, const MediaStreamRequest&);
+    void createMediaStream(NewMediaStreamHandler&&, String&&, CaptureDevice&& audioDevice, CaptureDevice&& videoDevice, const MediaStreamRequest&);
 
     WEBCORE_EXPORT Vector<CaptureDevice> getMediaStreamDevices();
-    WEBCORE_EXPORT std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&);
-    
+
     const RealtimeMediaSourceSupportedConstraints& supportedConstraints() { return m_supportedConstraints; }
 
-    WEBCORE_EXPORT static AudioCaptureFactory& audioFactory();
-    WEBCORE_EXPORT static void setAudioFactory(AudioCaptureFactory&);
-    WEBCORE_EXPORT static void unsetAudioFactory(AudioCaptureFactory&);
+    WEBCORE_EXPORT AudioCaptureFactory& audioCaptureFactory();
+    WEBCORE_EXPORT void setAudioCaptureFactory(AudioCaptureFactory&);
+    WEBCORE_EXPORT void unsetAudioCaptureFactory(AudioCaptureFactory&);
 
-    WEBCORE_EXPORT static VideoCaptureFactory& videoFactory();
-    WEBCORE_EXPORT static void setVideoFactory(VideoCaptureFactory&);
-    WEBCORE_EXPORT static void unsetVideoFactory(VideoCaptureFactory&);
+    WEBCORE_EXPORT VideoCaptureFactory& videoCaptureFactory();
+    WEBCORE_EXPORT void setVideoCaptureFactory(VideoCaptureFactory&);
+    WEBCORE_EXPORT void unsetVideoCaptureFactory(VideoCaptureFactory&);
 
-    WEBCORE_EXPORT static DisplayCaptureFactory& displayCaptureFactory();
-    WEBCORE_EXPORT static void setDisplayCaptureFactory(DisplayCaptureFactory&);
-    WEBCORE_EXPORT static void unsetDisplayCaptureFactory(DisplayCaptureFactory&);
+    WEBCORE_EXPORT DisplayCaptureFactory& displayCaptureFactory();
+    WEBCORE_EXPORT void setDisplayCaptureFactory(DisplayCaptureFactory&);
+    WEBCORE_EXPORT void unsetDisplayCaptureFactory(DisplayCaptureFactory&);
 
     WEBCORE_EXPORT String hashStringWithSalt(const String& id, const String& hashSalt);
 
@@ -92,16 +90,14 @@ public:
 
     void captureDevicesChanged();
 
-protected:
+private:
     RealtimeMediaSourceCenter();
+    friend class NeverDestroyed<RealtimeMediaSourceCenter>;
 
-    RealtimeMediaSourceSupportedConstraints m_supportedConstraints;
-
-    WEBCORE_EXPORT virtual AudioCaptureFactory& audioFactoryPrivate() = 0;
-    WEBCORE_EXPORT virtual VideoCaptureFactory& videoFactoryPrivate() = 0;
-    WEBCORE_EXPORT virtual DisplayCaptureFactory& displayCaptureFactoryPrivate() = 0;
+    AudioCaptureFactory& defaultAudioCaptureFactory();
+    VideoCaptureFactory& defaultVideoCaptureFactory();
+    DisplayCaptureFactory& defaultDisplayCaptureFactory();
 
-private:
     struct DeviceInfo {
         unsigned fitnessScore;
         CaptureDevice device;
@@ -110,7 +106,13 @@ private:
     void getDisplayMediaDevices(const MediaStreamRequest&, Vector<DeviceInfo>&, String&);
     void getUserMediaDevices(const MediaStreamRequest&, String&&, Vector<DeviceInfo>& audioDevices, Vector<DeviceInfo>& videoDevices, String&);
 
+    RealtimeMediaSourceSupportedConstraints m_supportedConstraints;
+
     WTF::Function<void()> m_deviceChangedObserver;
+
+    AudioCaptureFactory* m_audioCaptureFactoryOverride { nullptr };
+    VideoCaptureFactory* m_videoCaptureFactoryOverride { nullptr };
+    DisplayCaptureFactory* m_displayCaptureFactoryOverride { nullptr };
 };
 
 } // namespace WebCore
index 4f59a60..26db195 100644 (file)
@@ -47,7 +47,7 @@ RealtimeVideoSource::RealtimeVideoSource(String&& name, String&& id, String&& ha
 RealtimeVideoSource::~RealtimeVideoSource()
 {
 #if PLATFORM(IOS_FAMILY)
-    RealtimeMediaSourceCenter::singleton().videoFactory().unsetActiveSource(*this);
+    RealtimeMediaSourceCenter::singleton().videoCaptureFactory().unsetActiveSource(*this);
 #endif
 }
 
@@ -56,7 +56,7 @@ void RealtimeVideoSource::prepareToProduceData()
     ASSERT(frameRate());
 
 #if PLATFORM(IOS_FAMILY)
-    RealtimeMediaSourceCenter::singleton().videoFactory().setActiveSource(*this);
+    RealtimeMediaSourceCenter::singleton().videoCaptureFactory().setActiveSource(*this);
 #endif
 
     if (size().isEmpty() && !m_defaultSize.isEmpty())
index 816ba11..280ed94 100644 (file)
@@ -22,7 +22,7 @@
 #include "config.h"
 
 #if ENABLE(MEDIA_STREAM) && USE(LIBWEBRTC)
-#include "RealtimeMediaSourceCenterLibWebRTC.h"
+#include "RealtimeMediaSourceCenter.h"
 
 #include "GStreamerAudioCaptureSource.h"
 #include "GStreamerCaptureDevice.h"
 
 namespace WebCore {
 
-RealtimeMediaSourceCenterLibWebRTC& RealtimeMediaSourceCenterLibWebRTC::singleton()
-{
-    ASSERT(isMainThread());
-    static NeverDestroyed<RealtimeMediaSourceCenterLibWebRTC> center;
-    return center;
-}
-
-RealtimeMediaSourceCenter& RealtimeMediaSourceCenter::platformCenter()
-{
-    return RealtimeMediaSourceCenterLibWebRTC::singleton();
-}
-
-RealtimeMediaSourceCenterLibWebRTC::RealtimeMediaSourceCenterLibWebRTC()
-{
-}
-
-RealtimeMediaSourceCenterLibWebRTC::~RealtimeMediaSourceCenterLibWebRTC()
-{
-}
-
-AudioCaptureFactory& RealtimeMediaSourceCenterLibWebRTC::audioFactoryPrivate()
+AudioCaptureFactory& RealtimeMediaSourceCenter::defaultAudioCaptureFactory()
 {
     return GStreamerAudioCaptureSource::factory();
 }
 
-VideoCaptureFactory& RealtimeMediaSourceCenterLibWebRTC::videoFactoryPrivate()
+VideoCaptureFactory& RealtimeMediaSourceCenter::defaultVideoCaptureFactory()
 {
     return GStreamerVideoCaptureSource::factory();
 }
 
-DisplayCaptureFactory& RealtimeMediaSourceCenterLibWebRTC::displayCaptureFactoryPrivate()
+DisplayCaptureFactory& RealtimeMediaSourceCenter::defaultDisplayCaptureFactory()
 {
     return GStreamerVideoCaptureSource::displayFactory();
 }
diff --git a/Source/WebCore/platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h b/Source/WebCore/platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h
deleted file mode 100644 (file)
index c5cc622..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
- /*
- * Copyright (C) 2018 Metrological Group B.V.
- * Author: Thibault Saunier <tsaunier@igalia.com>
- * Author: Alejandro G. Castro <alex@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * aint with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#if ENABLE(MEDIA_STREAM) && USE(LIBWEBRTC)
-
-#include "CaptureDeviceManager.h"
-#include "LibWebRTCProvider.h"
-#include "RealtimeMediaSource.h"
-#include "RealtimeMediaSourceCenter.h"
-
-#include <webrtc/api/peerconnectioninterface.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class RealtimeMediaSourceCenterLibWebRTC final : public RealtimeMediaSourceCenter {
-public:
-    WEBCORE_EXPORT static RealtimeMediaSourceCenterLibWebRTC& singleton();
-
-private:
-    friend class NeverDestroyed<RealtimeMediaSourceCenterLibWebRTC>;
-    RealtimeMediaSourceCenterLibWebRTC();
-    ~RealtimeMediaSourceCenterLibWebRTC();
-
-    AudioCaptureFactory& audioFactoryPrivate() final;
-    VideoCaptureFactory& videoFactoryPrivate() final;
-    DisplayCaptureFactory& displayCaptureFactoryPrivate() final;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM) && USE(LIBWEBRTC)
-
index 55ebac8..9410587 100644 (file)
@@ -35,7 +35,7 @@
 #import "MediaConstraints.h"
 #import "MediaSampleAVFObjC.h"
 #import "PlatformLayer.h"
-#import "RealtimeMediaSourceCenterMac.h"
+#import "RealtimeMediaSourceCenter.h"
 #import "RealtimeMediaSourceSettings.h"
 #import "RealtimeVideoUtilities.h"
 #import <AVFoundation/AVCaptureDevice.h>
@@ -182,7 +182,7 @@ AVVideoCaptureSource::AVVideoCaptureSource(AVCaptureDeviceTypedef* device, Strin
 AVVideoCaptureSource::~AVVideoCaptureSource()
 {
 #if PLATFORM(IOS_FAMILY)
-    RealtimeMediaSourceCenter::singleton().videoFactory().unsetActiveSource(*this);
+    RealtimeMediaSourceCenter::singleton().videoCaptureFactory().unsetActiveSource(*this);
 #endif
     [m_objcObserver disconnect];
 
@@ -434,7 +434,7 @@ AVFrameRateRangeType* AVVideoCaptureSource::frameDurationForFrameRate(double rat
 bool AVVideoCaptureSource::setupCaptureSession()
 {
 #if PLATFORM(IOS_FAMILY)
-    RealtimeMediaSourceCenter::singleton().videoFactory().setActiveSource(*this);
+    RealtimeMediaSourceCenter::singleton().videoCaptureFactory().setActiveSource(*this);
 #endif
 
     NSError *error = nil;
index 3372fa2..0a0f634 100644 (file)
@@ -62,7 +62,7 @@ DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa(String&& name)
 DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa()
 {
 #if PLATFORM(IOS_FAMILY)
-    RealtimeMediaSourceCenter::singleton().videoFactory().unsetActiveSource(*this);
+    RealtimeMediaSourceCenter::singleton().videoCaptureFactory().unsetActiveSource(*this);
 #endif
 }
 
@@ -122,7 +122,7 @@ void DisplayCaptureSourceCocoa::settingsDidChange(OptionSet<RealtimeMediaSourceS
 void DisplayCaptureSourceCocoa::startProducingData()
 {
 #if PLATFORM(IOS_FAMILY)
-    RealtimeMediaSourceCenter::singleton().videoFactory().setActiveSource(*this);
+    RealtimeMediaSourceCenter::singleton().videoCaptureFactory().setActiveSource(*this);
 #endif
 
     m_startTime = MonotonicTime::now();
index 9d3cfc1..86dd8eb 100644 (file)
  */
 
 #include "config.h"
+#include "RealtimeMediaSourceCenter.h"
 
 #if ENABLE(MEDIA_STREAM)
-#include "RealtimeMediaSourceCenterMac.h"
-
 #include "AVCaptureDeviceManager.h"
 #include "AVVideoCaptureSource.h"
 #include "CoreAudioCaptureSource.h"
@@ -97,35 +96,18 @@ private:
     CaptureDeviceManager& displayCaptureDeviceManager() { return DisplayCaptureManagerCocoa::singleton(); }
 };
 
-RealtimeMediaSourceCenterMac& RealtimeMediaSourceCenterMac::singleton()
-{
-    ASSERT(isMainThread());
-    static NeverDestroyed<RealtimeMediaSourceCenterMac> center;
-    return center;
-}
-
-RealtimeMediaSourceCenter& RealtimeMediaSourceCenter::platformCenter()
-{
-    return RealtimeMediaSourceCenterMac::singleton();
-}
-
-RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac() = default;
-
-RealtimeMediaSourceCenterMac::~RealtimeMediaSourceCenterMac() = default;
-
-
-AudioCaptureFactory& RealtimeMediaSourceCenterMac::audioFactoryPrivate()
+AudioCaptureFactory& RealtimeMediaSourceCenter::defaultAudioCaptureFactory()
 {
     return CoreAudioCaptureSource::factory();
 }
 
-VideoCaptureFactory& RealtimeMediaSourceCenterMac::videoFactoryPrivate()
+VideoCaptureFactory& RealtimeMediaSourceCenter::defaultVideoCaptureFactory()
 {
     static NeverDestroyed<VideoCaptureSourceFactoryMac> factory;
     return factory.get();
 }
 
-DisplayCaptureFactory& RealtimeMediaSourceCenterMac::displayCaptureFactoryPrivate()
+DisplayCaptureFactory& RealtimeMediaSourceCenter::defaultDisplayCaptureFactory()
 {
     static NeverDestroyed<DisplayCaptureSourceFactoryMac> factory;
     return factory.get();
diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.h b/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.h
deleted file mode 100644 (file)
index eb07092..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013-2018 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.
- * 3. Neither the name of Ericsson nor the names of its contributors
- *    may be used to endorse or promote products derived from this
- *    software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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.
- */
-
-#ifndef RealtimeMediaSourceCenterMac_h
-#define RealtimeMediaSourceCenterMac_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "RealtimeMediaSource.h"
-#include "RealtimeMediaSourceCenter.h"
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class RealtimeMediaSourceCenterMac final : public RealtimeMediaSourceCenter {
-public:
-    WEBCORE_EXPORT static RealtimeMediaSourceCenterMac& singleton();
-
-private:
-    friend class NeverDestroyed<RealtimeMediaSourceCenterMac>;
-    RealtimeMediaSourceCenterMac();
-    ~RealtimeMediaSourceCenterMac();
-
-    AudioCaptureFactory& audioFactoryPrivate() final;
-    VideoCaptureFactory& videoFactoryPrivate() final;
-    DisplayCaptureFactory& displayCaptureFactoryPrivate() final;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
-
-#endif // RealtimeMediaSourceCenterMac_h
index d40757e..dc5a2d6 100644 (file)
@@ -72,7 +72,7 @@ MockRealtimeAudioSource::MockRealtimeAudioSource(String&& deviceID, String&& nam
 MockRealtimeAudioSource::~MockRealtimeAudioSource()
 {
 #if PLATFORM(IOS_FAMILY)
-    RealtimeMediaSourceCenter::singleton().audioFactory().unsetActiveSource(*this);
+    RealtimeMediaSourceCenter::singleton().audioCaptureFactory().unsetActiveSource(*this);
 #endif
 }
 
@@ -120,7 +120,7 @@ void MockRealtimeAudioSource::settingsDidChange(OptionSet<RealtimeMediaSourceSet
 void MockRealtimeAudioSource::startProducingData()
 {
 #if PLATFORM(IOS_FAMILY)
-    RealtimeMediaSourceCenter::singleton().audioFactory().setActiveSource(*this);
+    RealtimeMediaSourceCenter::singleton().audioCaptureFactory().setActiveSource(*this);
 #endif
 
     if (!sampleRate())
index 77b61f9..2719d15 100644 (file)
@@ -194,18 +194,18 @@ void MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled(bool
 
     if (active) {
         if (mock.m_isMockAudioCaptureEnabled)
-            center.setAudioFactory(mock.audioFactory());
+            center.setAudioCaptureFactory(mock.audioCaptureFactory());
         if (mock.m_isMockVideoCaptureEnabled)
-            center.setVideoFactory(mock.videoFactory());
+            center.setVideoCaptureFactory(mock.videoCaptureFactory());
         if (mock.m_isMockDisplayCaptureEnabled)
             center.setDisplayCaptureFactory(mock.displayCaptureFactory());
         return;
     }
 
     if (mock.m_isMockAudioCaptureEnabled)
-        center.unsetAudioFactory(mock.audioFactory());
+        center.unsetAudioCaptureFactory(mock.audioCaptureFactory());
     if (mock.m_isMockVideoCaptureEnabled)
-        center.unsetVideoFactory(mock.videoFactory());
+        center.unsetVideoCaptureFactory(mock.videoCaptureFactory());
     if (mock.m_isMockDisplayCaptureEnabled)
         center.unsetDisplayCaptureFactory(mock.displayCaptureFactory());
 }
@@ -335,13 +335,13 @@ Vector<CaptureDevice>& MockRealtimeMediaSourceCenter::displayDevices()
     return displayDevices;
 }
 
-AudioCaptureFactory& MockRealtimeMediaSourceCenter::audioFactory()
+AudioCaptureFactory& MockRealtimeMediaSourceCenter::audioCaptureFactory()
 {
     static NeverDestroyed<MockRealtimeAudioSourceFactory> factory;
     return factory.get();
 }
 
-VideoCaptureFactory& MockRealtimeMediaSourceCenter::videoFactory()
+VideoCaptureFactory& MockRealtimeMediaSourceCenter::videoCaptureFactory()
 {
     static NeverDestroyed<MockRealtimeVideoSourceFactory> factory;
     return factory.get();
index 7c182ba..6059087 100644 (file)
@@ -66,8 +66,8 @@ private:
     MockRealtimeMediaSourceCenter() = default;
     friend NeverDestroyed<MockRealtimeMediaSourceCenter>;
 
-    AudioCaptureFactory& audioFactory();
-    VideoCaptureFactory& videoFactory();
+    AudioCaptureFactory& audioCaptureFactory();
+    VideoCaptureFactory& videoCaptureFactory();
     DisplayCaptureFactory& displayCaptureFactory();
 
     class MockAudioCaptureDeviceManager final : public CaptureDeviceManager {
index 0dc7145..b149e04 100644 (file)
@@ -1,3 +1,18 @@
+2018-12-10  Youenn Fablet  <youenn@apple.com>
+
+        Remove derived classes of RealtimeMediaSourceCenter
+        https://bugs.webkit.org/show_bug.cgi?id=192546
+
+        Reviewed by Eric Carlson.
+
+        pdate code according WebCore changes.
+
+        * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
+        (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
+        * WebProcess/cocoa/UserMediaCaptureManager.cpp:
+        (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager):
+        (WebKit::UserMediaCaptureManager::initialize):
+
 2018-12-10  Tim Horton  <timothy_horton@apple.com>
 
         Animated scrolling on Google Maps scrolls the page in addition to moving the map
index af83b63..c26ec0a 100644 (file)
@@ -136,16 +136,16 @@ void UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstrai
     CaptureSourceOrError sourceOrError;
     switch (device.type()) {
     case WebCore::CaptureDevice::DeviceType::Microphone:
-        sourceOrError = RealtimeMediaSourceCenter::audioFactory().createAudioCaptureSource(device, WTFMove(hashSalt), &constraints);
+        sourceOrError = RealtimeMediaSourceCenter::singleton().audioCaptureFactory().createAudioCaptureSource(device, WTFMove(hashSalt), &constraints);
         break;
     case WebCore::CaptureDevice::DeviceType::Camera:
-        sourceOrError = RealtimeMediaSourceCenter::videoFactory().createVideoCaptureSource(device, WTFMove(hashSalt), &constraints);
+        sourceOrError = RealtimeMediaSourceCenter::singleton().videoCaptureFactory().createVideoCaptureSource(device, WTFMove(hashSalt), &constraints);
         break;
     case WebCore::CaptureDevice::DeviceType::Screen:
     case WebCore::CaptureDevice::DeviceType::Window:
     case WebCore::CaptureDevice::DeviceType::Application:
     case WebCore::CaptureDevice::DeviceType::Browser:
-        sourceOrError = RealtimeMediaSourceCenter::displayCaptureFactory().createDisplayCaptureSource(device, &constraints);
+        sourceOrError = RealtimeMediaSourceCenter::singleton().displayCaptureFactory().createDisplayCaptureSource(device, &constraints);
         break;
     case WebCore::CaptureDevice::DeviceType::Unknown:
         ASSERT_NOT_REACHED();
index 1cd8641..84f99ea 100644 (file)
@@ -206,9 +206,9 @@ UserMediaCaptureManager::UserMediaCaptureManager(WebProcess& process)
 
 UserMediaCaptureManager::~UserMediaCaptureManager()
 {
-    RealtimeMediaSourceCenter::unsetAudioFactory(*this);
-    RealtimeMediaSourceCenter::unsetDisplayCaptureFactory(*this);
-    RealtimeMediaSourceCenter::unsetVideoFactory(*this);
+    RealtimeMediaSourceCenter::singleton().unsetAudioCaptureFactory(*this);
+    RealtimeMediaSourceCenter::singleton().unsetDisplayCaptureFactory(*this);
+    RealtimeMediaSourceCenter::singleton().unsetVideoCaptureFactory(*this);
     m_process.removeMessageReceiver(Messages::UserMediaCaptureManager::messageReceiverName());
 }
 
@@ -224,11 +224,11 @@ void UserMediaCaptureManager::initialize(const WebProcessCreationParameters& par
     MockRealtimeMediaSourceCenter::singleton().setMockDisplayCaptureEnabled(!parameters.shouldCaptureDisplayInUIProcess);
 
     if (parameters.shouldCaptureAudioInUIProcess)
-        RealtimeMediaSourceCenter::setAudioFactory(*this);
+        RealtimeMediaSourceCenter::singleton().setAudioCaptureFactory(*this);
     if (parameters.shouldCaptureVideoInUIProcess)
-        RealtimeMediaSourceCenter::setVideoFactory(*this);
+        RealtimeMediaSourceCenter::singleton().setVideoCaptureFactory(*this);
     if (parameters.shouldCaptureDisplayInUIProcess)
-        RealtimeMediaSourceCenter::setDisplayCaptureFactory(*this);
+        RealtimeMediaSourceCenter::singleton().setDisplayCaptureFactory(*this);
 }
 
 WebCore::CaptureSourceOrError UserMediaCaptureManager::createCaptureSource(const CaptureDevice& device, String&& hashSalt, const WebCore::MediaConstraints* constraints)