Changeset 239024 in webkit
- Timestamp:
- Dec 9, 2018 9:30:23 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r239018 r239024 1 2018-12-09 Youenn Fablet <youenn@apple.com> 2 3 Move capture manager from RealtimeMediaSourceCenter to capture factory 4 https://bugs.webkit.org/show_bug.cgi?id=192542 5 6 Reviewed by Eric Carlson. 7 8 We should be able to run mock captures in wither UIProcess or WebProcess. 9 Currently, mock capture is only done in WebProcess. 10 This patch is a first step towards that goal. 11 12 It also simplifies RealtimeMediaSourceCenter implementation by starting to remove virtual methods. 13 Further refactoring will remove the need to subclass RealtimeMediaSourceCenter. 14 Instead, remaining virtual methods will become non virtual and their 15 implementation will become port specific. 16 17 Removed a JS internal method that is not longer used to further simplify RealtimeMediaSourceCenter. 18 19 No visible change of behavior. 20 Covered by existing tests. 21 22 * platform/mediastream/CaptureDeviceManager.h: 23 * platform/mediastream/RealtimeMediaSourceCenter.cpp: 24 (WebCore::RealtimeMediaSourceCenter::singleton): 25 (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): 26 (WebCore::RealtimeMediaSourceCenter::getDisplayMediaDevices): 27 (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices): 28 (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): 29 (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory): 30 (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory): 31 (WebCore::RealtimeMediaSourceCenter::unsetDisplayCaptureFactory): 32 * platform/mediastream/RealtimeMediaSourceCenter.h: 33 * platform/mediastream/RealtimeMediaSourceFactory.h: 34 * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp: 35 * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp: 36 * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp: 37 * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h: 38 * platform/mediastream/mac/CoreAudioCaptureSource.cpp: 39 (WebCore::CoreAudioCaptureSourceFactory::audioCaptureDeviceManager): 40 * platform/mediastream/mac/CoreAudioCaptureSource.h: 41 * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp: 42 * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: 43 * platform/mock/MockRealtimeMediaSourceCenter.cpp: 44 (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled): 45 (WebCore::MockRealtimeMediaSourceCenter::audioFactory): 46 (WebCore::MockRealtimeMediaSourceCenter::videoFactory): 47 (WebCore::MockRealtimeMediaSourceCenter::displayCaptureFactory): 48 * platform/mock/MockRealtimeMediaSourceCenter.h: 49 (WebCore::MockRealtimeMediaSourceCenter::audioCaptureDeviceManager): 50 (WebCore::MockRealtimeMediaSourceCenter::videoCaptureDeviceManager): 51 (WebCore::MockRealtimeMediaSourceCenter::displayCaptureDeviceManager): 52 * testing/Internals.cpp: 53 * testing/Internals.h: 54 * testing/Internals.idl: 55 1 56 2018-12-09 Commit Queue <commit-queue@webkit.org> 2 57 -
trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.h
r235086 r239024 34 34 namespace WebCore { 35 35 36 class CaptureDeviceManager : public CanMakeWeakPtr<CaptureDeviceManager> {36 class WEBCORE_EXPORT CaptureDeviceManager : public CanMakeWeakPtr<CaptureDeviceManager> { 37 37 public: 38 38 virtual const Vector<CaptureDevice>& captureDevices() = 0; -
trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp
r237234 r239024 36 36 #if ENABLE(MEDIA_STREAM) 37 37 38 // FIXME: GTK to implement its own RealtimeMediaSourceCenter.39 #if PLATFORM(GTK)40 #include "MockRealtimeMediaSourceCenter.h"41 #endif42 43 38 #include "CaptureDeviceManager.h" 44 39 #include "Logging.h" … … 48 43 namespace WebCore { 49 44 50 static RealtimeMediaSourceCenter*& mediaStreamCenterOverride()51 {52 static RealtimeMediaSourceCenter* override;53 return override;54 }55 45 56 46 RealtimeMediaSourceCenter& RealtimeMediaSourceCenter::singleton() 57 47 { 58 RealtimeMediaSourceCenter* override = mediaStreamCenterOverride();59 if (override)60 return *override;61 48 return RealtimeMediaSourceCenter::platformCenter(); 62 }63 64 void RealtimeMediaSourceCenter::setSharedStreamCenterOverride(RealtimeMediaSourceCenter* center)65 {66 mediaStreamCenterOverride() = center;67 49 } 68 50 … … 125 107 { 126 108 Vector<CaptureDevice> result; 127 for (auto& device : audio CaptureDeviceManager().captureDevices()) {109 for (auto& device : audioFactory().audioCaptureDeviceManager().captureDevices()) { 128 110 if (device.enabled()) 129 111 result.append(device); 130 112 } 131 for (auto& device : video CaptureDeviceManager().captureDevices()) {113 for (auto& device : videoFactory().videoCaptureDeviceManager().captureDevices()) { 132 114 if (device.enabled()) 133 115 result.append(device); 134 116 } 135 for (auto& device : displayCapture DeviceManager().captureDevices()) {117 for (auto& device : displayCaptureFactory().displayCaptureDeviceManager().captureDevices()) { 136 118 if (device.enabled()) 137 119 result.append(device); … … 173 155 } 174 156 175 CaptureDevice RealtimeMediaSourceCenter::captureDeviceWithUniqueID(const String& uniqueID, const String& idHashSalt)176 {177 for (auto& device : getMediaStreamDevices()) {178 if (uniqueID == hashStringWithSalt(device.persistentId(), idHashSalt))179 return device;180 }181 182 return { };183 }184 185 ExceptionOr<void> RealtimeMediaSourceCenter::setDeviceEnabled(const String& id, bool enabled)186 {187 for (auto& captureDevice : getMediaStreamDevices()) {188 if (id == captureDevice.persistentId()) {189 if (enabled != captureDevice.enabled()) {190 captureDevice.setEnabled(enabled);191 captureDevicesChanged();192 }193 194 return { };195 }196 }197 198 return Exception { NotFoundError };199 }200 201 157 void RealtimeMediaSourceCenter::setDevicesChangedObserver(std::function<void()>&& observer) 202 158 { … … 219 175 220 176 String invalidConstraint; 221 for (auto& device : displayCapture DeviceManager().captureDevices()) {177 for (auto& device : displayCaptureFactory().displayCaptureDeviceManager().captureDevices()) { 222 178 if (!device.enabled()) 223 179 return; … … 236 192 String invalidConstraint; 237 193 if (request.audioConstraints.isValid) { 238 for (auto& device : audio CaptureDeviceManager().captureDevices()) {194 for (auto& device : audioFactory().audioCaptureDeviceManager().captureDevices()) { 239 195 if (!device.enabled()) 240 196 continue; … … 250 206 251 207 if (request.videoConstraints.isValid) { 252 for (auto& device : video CaptureDeviceManager().captureDevices()) {208 for (auto& device : videoFactory().videoCaptureDeviceManager().captureDevices()) { 253 209 if (!device.enabled()) 254 210 continue; … … 315 271 switch (type) { 316 272 case CaptureDevice::DeviceType::Camera: 317 return video CaptureDeviceManager().captureDeviceWithPersistentID(type, id);273 return videoFactory().videoCaptureDeviceManager().captureDeviceWithPersistentID(type, id); 318 274 break; 319 275 case CaptureDevice::DeviceType::Microphone: 320 return audio CaptureDeviceManager().captureDeviceWithPersistentID(type, id);276 return audioFactory().audioCaptureDeviceManager().captureDeviceWithPersistentID(type, id); 321 277 break; 322 278 case CaptureDevice::DeviceType::Screen: … … 324 280 case CaptureDevice::DeviceType::Window: 325 281 case CaptureDevice::DeviceType::Browser: 326 return displayCapture DeviceManager().captureDeviceWithPersistentID(type, id);282 return displayCaptureFactory().displayCaptureDeviceManager().captureDeviceWithPersistentID(type, id); 327 283 break; 328 284 case CaptureDevice::DeviceType::Unknown: … … 342 298 { 343 299 ASSERT_UNUSED(oldOverride, audioFactoryOverride == &oldOverride); 344 audioFactoryOverride = nullptr; 300 if (&oldOverride == audioFactoryOverride) 301 audioFactoryOverride = nullptr; 345 302 } 346 303 … … 358 315 { 359 316 ASSERT_UNUSED(oldOverride, videoFactoryOverride == &oldOverride); 360 videoFactoryOverride = nullptr; 317 if (&oldOverride == videoFactoryOverride) 318 videoFactoryOverride = nullptr; 361 319 } 362 320 … … 374 332 { 375 333 ASSERT_UNUSED(oldOverride, displayCaptureFactoryOverride == &oldOverride); 376 displayCaptureFactoryOverride = nullptr; 334 if (&oldOverride == displayCaptureFactoryOverride) 335 displayCaptureFactoryOverride = nullptr; 377 336 } 378 337 -
trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h
r238796 r239024 56 56 class RealtimeMediaSourceCenter { 57 57 public: 58 static RealtimeMediaSourceCenter& platformCenter(); 58 59 virtual ~RealtimeMediaSourceCenter(); 59 60 60 61 WEBCORE_EXPORT static RealtimeMediaSourceCenter& singleton(); 61 static void setSharedStreamCenterOverride(RealtimeMediaSourceCenter*);62 62 63 63 using ValidConstraintsHandler = WTF::Function<void(Vector<CaptureDevice>&& audioDeviceUIDs, Vector<CaptureDevice>&& videoDeviceUIDs, String&&)>; … … 68 68 virtual void createMediaStream(NewMediaStreamHandler&&, String&&, CaptureDevice&& audioDevice, CaptureDevice&& videoDevice, const MediaStreamRequest&); 69 69 70 WEBCORE_EXPORT virtualVector<CaptureDevice> getMediaStreamDevices();70 WEBCORE_EXPORT Vector<CaptureDevice> getMediaStreamDevices(); 71 71 WEBCORE_EXPORT std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&); 72 72 … … 85 85 WEBCORE_EXPORT static void unsetDisplayCaptureFactory(DisplayCaptureFactory&); 86 86 87 virtual CaptureDeviceManager& audioCaptureDeviceManager() = 0;88 virtual CaptureDeviceManager& videoCaptureDeviceManager() = 0;89 virtual CaptureDeviceManager& displayCaptureDeviceManager() = 0;90 91 87 WEBCORE_EXPORT String hashStringWithSalt(const String& id, const String& hashSalt); 92 WEBCORE_EXPORT CaptureDevice captureDeviceWithUniqueID(const String& id, const String& hashSalt);93 WEBCORE_EXPORT ExceptionOr<void> setDeviceEnabled(const String&, bool);94 88 95 89 WEBCORE_EXPORT void setDevicesChangedObserver(std::function<void()>&&); … … 102 96 RealtimeMediaSourceCenter(); 103 97 104 static RealtimeMediaSourceCenter& platformCenter();105 98 RealtimeMediaSourceSupportedConstraints m_supportedConstraints; 106 99 -
trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h
r237266 r239024 33 33 34 34 class CaptureDevice; 35 class CaptureDeviceManager; 35 36 class RealtimeMediaSource; 36 37 … … 56 57 virtual ~AudioCaptureFactory() = default; 57 58 virtual CaptureSourceOrError createAudioCaptureSource(const CaptureDevice&, String&&, const MediaConstraints*) = 0; 59 virtual CaptureDeviceManager& audioCaptureDeviceManager() = 0; 58 60 59 61 protected: … … 69 71 virtual ~VideoCaptureFactory() = default; 70 72 virtual CaptureSourceOrError createVideoCaptureSource(const CaptureDevice&, String&&, const MediaConstraints*) = 0; 73 virtual CaptureDeviceManager& videoCaptureDeviceManager() = 0; 71 74 virtual void setVideoCapturePageState(bool, bool) { } 72 75 … … 79 82 virtual ~DisplayCaptureFactory() = default; 80 83 virtual CaptureSourceOrError createDisplayCaptureSource(const CaptureDevice&, const MediaConstraints*) = 0; 84 virtual CaptureDeviceManager& displayCaptureDeviceManager() = 0; 81 85 virtual void setDisplayCapturePageState(bool , bool) { } 82 86 -
trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp
r236877 r239024 58 58 return GStreamerAudioCaptureSource::create(String { device.persistentId() }, WTFMove(hashSalt), constraints); 59 59 } 60 private: 61 CaptureDeviceManager& audioCaptureDeviceManager() final { return GStreamerAudioCaptureDeviceManager::singleton(); } 60 62 }; 61 63 -
trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp
r238607 r239024 72 72 return GStreamerVideoCaptureSource::create(String { device.persistentId() }, WTFMove(hashSalt), constraints); 73 73 } 74 private: 75 CaptureDeviceManager& videoCaptureDeviceManager() final { return GStreamerVideoCaptureDeviceManager::singleton(); } 74 76 }; 75 77 … … 87 89 return { }; 88 90 } 91 private: 92 CaptureDeviceManager& displayCaptureDeviceManager() final { return GStreamerDisplayCaptureDeviceManager::singleton(); } 89 93 }; 90 94 -
trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp
r237234 r239024 27 27 #include "GStreamerAudioCaptureSource.h" 28 28 #include "GStreamerCaptureDevice.h" 29 #include "GStreamerCaptureDeviceManager.h"30 29 #include "GStreamerVideoCaptureSource.h" 31 30 #include <wtf/MainThread.h> … … 68 67 } 69 68 70 CaptureDeviceManager& RealtimeMediaSourceCenterLibWebRTC::audioCaptureDeviceManager()71 {72 return GStreamerAudioCaptureDeviceManager::singleton();73 }74 75 CaptureDeviceManager& RealtimeMediaSourceCenterLibWebRTC::videoCaptureDeviceManager()76 {77 return GStreamerVideoCaptureDeviceManager::singleton();78 }79 80 CaptureDeviceManager& RealtimeMediaSourceCenterLibWebRTC::displayCaptureDeviceManager()81 {82 return GStreamerDisplayCaptureDeviceManager::singleton();83 }84 85 69 } // namespace WebCore 86 70 -
trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h
r237234 r239024 47 47 VideoCaptureFactory& videoFactoryPrivate() final; 48 48 DisplayCaptureFactory& displayCaptureFactoryPrivate() final; 49 50 CaptureDeviceManager& audioCaptureDeviceManager() final;51 CaptureDeviceManager& videoCaptureDeviceManager() final;52 CaptureDeviceManager& displayCaptureDeviceManager() final;53 54 AudioCaptureFactory* m_audioFactoryOverride { nullptr };55 49 }; 56 50 -
trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp
r237837 r239024 775 775 } 776 776 777 CaptureDeviceManager& CoreAudioCaptureSourceFactory::audioCaptureDeviceManager() 778 { 779 #if PLATFORM(MAC) 780 return CoreAudioCaptureDeviceManager::singleton(); 781 #else 782 return AVAudioSessionCaptureDeviceManager::singleton(); 783 #endif 784 } 785 777 786 CoreAudioCaptureSource::CoreAudioCaptureSource(String&& deviceID, String&& label, String&& hashSalt, uint32_t persistentID) 778 787 : RealtimeMediaSource(RealtimeMediaSource::Type::Audio, WTFMove(label), WTFMove(deviceID), WTFMove(hashSalt)) -
trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h
r237266 r239024 131 131 return CoreAudioCaptureSource::create(String { device.persistentId() }, WTFMove(hashSalt), constraints); 132 132 } 133 134 CaptureDeviceManager& audioCaptureDeviceManager() final; 133 135 }; 134 136 -
trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp
r237266 r239024 34 34 #include "RealtimeMediaSourceCenterMac.h" 35 35 36 #include "AVAudioSessionCaptureDeviceManager.h"37 36 #include "AVCaptureDeviceManager.h" 38 37 #include "AVVideoCaptureSource.h" 39 #include "CoreAudioCaptureDeviceManager.h"40 38 #include "CoreAudioCaptureSource.h" 41 39 #include "DisplayCaptureManagerCocoa.h" … … 56 54 } 57 55 56 private: 58 57 #if PLATFORM(IOS_FAMILY) 59 private:60 58 void setVideoCapturePageState(bool interrupted, bool pageMuted) 61 59 { … … 64 62 } 65 63 #endif 64 65 CaptureDeviceManager& videoCaptureDeviceManager() { return AVCaptureDeviceManager::singleton(); } 66 66 }; 67 67 … … 94 94 return { }; 95 95 } 96 private: 97 CaptureDeviceManager& displayCaptureDeviceManager() { return DisplayCaptureManagerCocoa::singleton(); } 96 98 }; 97 99 … … 130 132 } 131 133 132 CaptureDeviceManager& RealtimeMediaSourceCenterMac::audioCaptureDeviceManager()133 {134 #if PLATFORM(MAC)135 return CoreAudioCaptureDeviceManager::singleton();136 #else137 return AVAudioSessionCaptureDeviceManager::singleton();138 #endif139 }140 141 CaptureDeviceManager& RealtimeMediaSourceCenterMac::videoCaptureDeviceManager()142 {143 return AVCaptureDeviceManager::singleton();144 }145 146 CaptureDeviceManager& RealtimeMediaSourceCenterMac::displayCaptureDeviceManager()147 {148 return DisplayCaptureManagerCocoa::singleton();149 }150 151 134 } // namespace WebCore 152 135 -
trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.h
r237234 r239024 53 53 VideoCaptureFactory& videoFactoryPrivate() final; 54 54 DisplayCaptureFactory& displayCaptureFactoryPrivate() final; 55 56 CaptureDeviceManager& audioCaptureDeviceManager() final;57 CaptureDeviceManager& videoCaptureDeviceManager() final;58 CaptureDeviceManager& displayCaptureDeviceManager() final;59 60 AudioCaptureFactory* m_audioFactoryOverride { nullptr };61 55 }; 62 56 -
trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp
r237266 r239024 95 95 } 96 96 97 private: 97 98 #if PLATFORM(IOS_FAMILY) 98 private:99 99 void setVideoCapturePageState(bool interrupted, bool pageMuted) 100 100 { … … 103 103 } 104 104 #endif 105 CaptureDeviceManager& videoCaptureDeviceManager() final { return MockRealtimeMediaSourceCenter::singleton().videoCaptureDeviceManager(); } 105 106 }; 106 107 … … 127 128 return { }; 128 129 } 130 private: 131 CaptureDeviceManager& displayCaptureDeviceManager() final { return MockRealtimeMediaSourceCenter::singleton().displayCaptureDeviceManager(); } 129 132 }; 130 133 … … 138 141 return MockRealtimeAudioSource::create(String { device.persistentId() }, String { device.label() }, WTFMove(hashSalt), constraints); 139 142 } 143 private: 144 CaptureDeviceManager& audioCaptureDeviceManager() final { return MockRealtimeMediaSourceCenter::singleton().audioCaptureDeviceManager(); } 140 145 }; 141 146 … … 180 185 { 181 186 static bool active = false; 182 if (active != enabled) { 183 active = enabled; 184 RealtimeMediaSourceCenter::setSharedStreamCenterOverride(enabled ? &singleton() : nullptr); 185 } 187 if (active == enabled) 188 return; 189 190 active = enabled; 191 192 RealtimeMediaSourceCenter& center = RealtimeMediaSourceCenter::singleton(); 193 MockRealtimeMediaSourceCenter& mock = singleton(); 194 195 if (active) { 196 center.setAudioFactory(mock.audioFactory()); 197 center.setVideoFactory(mock.videoFactory()); 198 center.setDisplayCaptureFactory(mock.displayCaptureFactory()); 199 return; 200 } 201 202 center.unsetAudioFactory(mock.audioFactory()); 203 center.unsetVideoFactory(mock.videoFactory()); 204 center.unsetDisplayCaptureFactory(mock.displayCaptureFactory()); 186 205 } 187 206 … … 311 330 } 312 331 313 AudioCaptureFactory& MockRealtimeMediaSourceCenter::audioFactory Private()332 AudioCaptureFactory& MockRealtimeMediaSourceCenter::audioFactory() 314 333 { 315 334 static NeverDestroyed<MockRealtimeAudioSourceFactory> factory; … … 317 336 } 318 337 319 VideoCaptureFactory& MockRealtimeMediaSourceCenter::videoFactory Private()338 VideoCaptureFactory& MockRealtimeMediaSourceCenter::videoFactory() 320 339 { 321 340 static NeverDestroyed<MockRealtimeVideoSourceFactory> factory; … … 323 342 } 324 343 325 DisplayCaptureFactory& MockRealtimeMediaSourceCenter::displayCaptureFactory Private()344 DisplayCaptureFactory& MockRealtimeMediaSourceCenter::displayCaptureFactory() 326 345 { 327 346 static NeverDestroyed<MockRealtimeDisplaySourceFactory> factory; -
trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h
r237234 r239024 37 37 namespace WebCore { 38 38 39 class MockRealtimeMediaSourceCenter final : public RealtimeMediaSourceCenter{39 class MockRealtimeMediaSourceCenter { 40 40 public: 41 static MockRealtimeMediaSourceCenter& singleton(); 42 41 43 WEBCORE_EXPORT static void setMockRealtimeMediaSourceCenterEnabled(bool); 42 44 … … 53 55 static std::optional<CaptureDevice> captureDeviceWithPersistentID(CaptureDevice::DeviceType, const String&); 54 56 57 CaptureDeviceManager& audioCaptureDeviceManager() { return m_audioCaptureDeviceManager; } 58 CaptureDeviceManager& videoCaptureDeviceManager() { return m_videoCaptureDeviceManager; } 59 CaptureDeviceManager& displayCaptureDeviceManager() { return m_displayCaptureDeviceManager; } 60 55 61 private: 56 62 MockRealtimeMediaSourceCenter() = default; 57 63 friend NeverDestroyed<MockRealtimeMediaSourceCenter>; 58 64 59 static MockRealtimeMediaSourceCenter& singleton(); 60 61 AudioCaptureFactory& audioFactoryPrivate() final; 62 VideoCaptureFactory& videoFactoryPrivate() final; 63 DisplayCaptureFactory& displayCaptureFactoryPrivate() final; 64 65 CaptureDeviceManager& audioCaptureDeviceManager() final { return m_audioCaptureDeviceManager; } 66 CaptureDeviceManager& videoCaptureDeviceManager() final { return m_videoCaptureDeviceManager; } 67 CaptureDeviceManager& displayCaptureDeviceManager() final { return m_displayCaptureDeviceManager; } 65 AudioCaptureFactory& audioFactory(); 66 VideoCaptureFactory& videoFactory(); 67 DisplayCaptureFactory& displayCaptureFactory(); 68 68 69 69 class MockAudioCaptureDeviceManager final : public CaptureDeviceManager { -
trunk/Source/WebCore/testing/Internals.cpp
r238902 r239024 4534 4534 } 4535 4535 4536 ExceptionOr<void> Internals::setMediaDeviceState(const String& id, const String& property, bool value)4537 {4538 auto* document = contextDocument();4539 if (!document)4540 return Exception { InvalidAccessError, "No context document"_s };4541 4542 if (!equalLettersIgnoringASCIICase(property, "enabled"))4543 return Exception { InvalidAccessError, makeString("\"" + property, "\" is not a valid property for this method.") };4544 4545 auto salt = document->deviceIDHashSalt();4546 CaptureDevice device = RealtimeMediaSourceCenter::singleton().captureDeviceWithUniqueID(id, salt);4547 if (!device)4548 return Exception { InvalidAccessError, makeString("device with ID \"" + id, "\" not found.") };4549 4550 auto result = RealtimeMediaSourceCenter::singleton().setDeviceEnabled(device.persistentId(), value);4551 if (result.hasException())4552 return result.releaseException();4553 4554 return { };4555 }4556 4557 4536 void Internals::delayMediaStreamTrackSamples(MediaStreamTrack& track, float delay) 4558 4537 { -
trunk/Source/WebCore/testing/Internals.h
r238902 r239024 678 678 #if ENABLE(MEDIA_STREAM) 679 679 void setCameraMediaStreamTrackOrientation(MediaStreamTrack&, int orientation); 680 ExceptionOr<void> setMediaDeviceState(const String& id, const String& property, bool value);681 680 unsigned long trackAudioSampleCount() const { return m_trackAudioSampleCount; } 682 681 unsigned long trackVideoSampleCount() const { return m_trackVideoSampleCount; } -
trunk/Source/WebCore/testing/Internals.idl
r238902 r239024 665 665 [Conditional=MEDIA_STREAM] readonly attribute unsigned long trackAudioSampleCount; 666 666 [Conditional=MEDIA_STREAM] readonly attribute unsigned long trackVideoSampleCount; 667 [Conditional=MEDIA_STREAM, MayThrowException] void setMediaDeviceState(DOMString deviceID, DOMString property, boolean value);668 667 [Conditional=MEDIA_STREAM] void delayMediaStreamTrackSamples(MediaStreamTrack track, float delay); 669 668 [Conditional=MEDIA_STREAM] void setMediaStreamTrackMuted(MediaStreamTrack track, boolean muted); -
trunk/Source/WebKit/ChangeLog
r239023 r239024 1 2018-12-09 Youenn Fablet <youenn@apple.com> 2 3 Move capture manager from RealtimeMediaSourceCenter to capture factory 4 https://bugs.webkit.org/show_bug.cgi?id=192542 5 6 Reviewed by Eric Carlson. 7 8 Make sure to unregister for video capture as done for other capture types. 9 Implement manager which should be doing nothing as the manager is used for enumeration of devices 10 which should only happen in UIProcess. 11 12 Given that mock capture is interfering with UserMediaCaptureManager, 13 switching on/off mock capture will require creating a new process. 14 This shortcoming should be fixed once mock capture will be fully happening in 15 the same process as regular capture. 16 17 * WebProcess/cocoa/UserMediaCaptureManager.cpp: 18 (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager): 19 * WebProcess/cocoa/UserMediaCaptureManager.h: 20 1 21 2018-12-09 Saam barati <sbarati@apple.com> 2 22 -
trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp
r238909 r239024 208 208 RealtimeMediaSourceCenter::unsetAudioFactory(*this); 209 209 RealtimeMediaSourceCenter::unsetDisplayCaptureFactory(*this); 210 RealtimeMediaSourceCenter::unsetVideoFactory(*this); 210 211 m_process.removeMessageReceiver(Messages::UserMediaCaptureManager::messageReceiverName()); 211 212 } -
trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h
r237281 r239024 31 31 #include "SharedMemory.h" 32 32 #include "WebProcessSupplement.h" 33 #include <WebCore/CaptureDeviceManager.h> 33 34 #include <WebCore/RealtimeMediaSource.h> 34 35 #include <WebCore/RealtimeMediaSourceFactory.h> … … 62 63 WebCore::CaptureSourceOrError createCaptureSource(const WebCore::CaptureDevice&, String&&, const WebCore::MediaConstraints*); 63 64 65 class NoOpCaptureDeviceManager : public WebCore::CaptureDeviceManager { 66 public: 67 NoOpCaptureDeviceManager() = default; 68 69 private: 70 const Vector<WebCore::CaptureDevice>& captureDevices() final 71 { 72 ASSERT_NOT_REACHED(); 73 return m_emptyDevices; 74 } 75 Vector<WebCore::CaptureDevice> m_emptyDevices; 76 }; 77 78 WebCore::CaptureDeviceManager& audioCaptureDeviceManager() final { return m_noOpCaptureDeviceManager; } 79 WebCore::CaptureDeviceManager& videoCaptureDeviceManager() final { return m_noOpCaptureDeviceManager; } 80 WebCore::CaptureDeviceManager& displayCaptureDeviceManager() final { return m_noOpCaptureDeviceManager; } 81 64 82 // IPC::MessageReceiver 65 83 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; … … 87 105 HashMap<uint64_t, RefPtr<Source>> m_sources; 88 106 WebProcess& m_process; 107 NoOpCaptureDeviceManager m_noOpCaptureDeviceManager; 89 108 }; 90 109
Note: See TracChangeset
for help on using the changeset viewer.