WebKit Bugzilla
Attachment 356942 Details for
Bug 192544
: Make mock capture happen in the process used for real capture
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192544-20181209205808.patch (text/plain), 6.83 KB, created by
youenn fablet
on 2018-12-09 20:58:10 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-12-09 20:58:10 PST
Size:
6.83 KB
patch
obsolete
>Subversion Revision: 239012 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 08892adc53b2b86383bc13a4bcfac91a4b145cb0..3a739834ba83b059e046e27c19a0fc795cb40a1e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-12-09 Youenn Fablet <youenn@apple.com> >+ >+ Make mock capture happen in the process used for real capture >+ https://bugs.webkit.org/show_bug.cgi?id=192544 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ MockRealtimeMediaSourceCenter previously was setting its factories whenever mock capture is on. >+ Add booleans to choose which source (audio, video, display) will actually be toggled on. >+ >+ Covered by existing tests. >+ >+ * platform/mock/MockRealtimeMediaSourceCenter.cpp: >+ (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled): >+ * platform/mock/MockRealtimeMediaSourceCenter.h: >+ (WebCore::MockRealtimeMediaSourceCenter::setMockAudioCaptureEnabled): >+ (WebCore::MockRealtimeMediaSourceCenter::setMockVideoCaptureEnabled): >+ (WebCore::MockRealtimeMediaSourceCenter::setMockDisplayCaptureEnabled): >+ > 2018-12-09 Youenn Fablet <youenn@apple.com> > > Move capture manager from RealtimeMediaSourceCenter to capture factory >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 54990ce023cb1f703ff35583798e87e3627ca5c5..aa7812d4b46250b1283d2529d289a85ab36c0935 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,17 @@ >+2018-12-09 Youenn Fablet <youenn@apple.com> >+ >+ Make mock capture happen in the process used for real capture >+ https://bugs.webkit.org/show_bug.cgi?id=192544 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make mock capture happen in the right process by only overriding >+ factories by mock factories for source types that UserMediaCaptureManager will not override. >+ That way, UserMediaCaptureManager will be used to go to UIProcess, where mock will be used as if it was the real capture. >+ >+ * WebProcess/cocoa/UserMediaCaptureManager.cpp: >+ (WebKit::UserMediaCaptureManager::initialize): >+ > 2018-12-09 Youenn Fablet <youenn@apple.com> > > Move capture manager from RealtimeMediaSourceCenter to capture factory >diff --git a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >index 40a52bdfeb09fc2764f76e4d1714133f8d049af9..77b61f90b29caaceb61e3be4c8c50a0c1a0cc44e 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >@@ -193,15 +193,21 @@ void MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled(bool > MockRealtimeMediaSourceCenter& mock = singleton(); > > if (active) { >- center.setAudioFactory(mock.audioFactory()); >- center.setVideoFactory(mock.videoFactory()); >- center.setDisplayCaptureFactory(mock.displayCaptureFactory()); >+ if (mock.m_isMockAudioCaptureEnabled) >+ center.setAudioFactory(mock.audioFactory()); >+ if (mock.m_isMockVideoCaptureEnabled) >+ center.setVideoFactory(mock.videoFactory()); >+ if (mock.m_isMockDisplayCaptureEnabled) >+ center.setDisplayCaptureFactory(mock.displayCaptureFactory()); > return; > } > >- center.unsetAudioFactory(mock.audioFactory()); >- center.unsetVideoFactory(mock.videoFactory()); >- center.unsetDisplayCaptureFactory(mock.displayCaptureFactory()); >+ if (mock.m_isMockAudioCaptureEnabled) >+ center.unsetAudioFactory(mock.audioFactory()); >+ if (mock.m_isMockVideoCaptureEnabled) >+ center.unsetVideoFactory(mock.videoFactory()); >+ if (mock.m_isMockDisplayCaptureEnabled) >+ center.unsetDisplayCaptureFactory(mock.displayCaptureFactory()); > } > > static void createCaptureDevice(const MockMediaDevice& device) >diff --git a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h >index 44f938b5220c3c9528e1d5c0a2557bf6b057fd14..7c182ba5e576ca30dc4a43062f26e68de55f6f84 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h >+++ b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h >@@ -38,7 +38,7 @@ namespace WebCore { > > class MockRealtimeMediaSourceCenter { > public: >- static MockRealtimeMediaSourceCenter& singleton(); >+ WEBCORE_EXPORT static MockRealtimeMediaSourceCenter& singleton(); > > WEBCORE_EXPORT static void setMockRealtimeMediaSourceCenterEnabled(bool); > >@@ -47,6 +47,10 @@ public: > WEBCORE_EXPORT static void removeDevice(const String& persistentId); > WEBCORE_EXPORT static void resetDevices(); > >+ void setMockAudioCaptureEnabled(bool isEnabled) { m_isMockAudioCaptureEnabled = isEnabled; } >+ void setMockVideoCaptureEnabled(bool isEnabled) { m_isMockVideoCaptureEnabled = isEnabled; } >+ void setMockDisplayCaptureEnabled(bool isEnabled) { m_isMockDisplayCaptureEnabled = isEnabled; } >+ > static Vector<CaptureDevice>& audioDevices(); > static Vector<CaptureDevice>& videoDevices(); > static Vector<CaptureDevice>& displayDevices(); >@@ -85,6 +89,10 @@ private: > MockAudioCaptureDeviceManager m_audioCaptureDeviceManager; > MockVideoCaptureDeviceManager m_videoCaptureDeviceManager; > MockDisplayCaptureDeviceManager m_displayCaptureDeviceManager; >+ >+ bool m_isMockAudioCaptureEnabled { true }; >+ bool m_isMockVideoCaptureEnabled { true }; >+ bool m_isMockDisplayCaptureEnabled { true }; > }; > > } >diff --git a/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp b/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >index 8271fd07b672f8df54f8635e6b23786338dd8a14..1cd8641c58dacd6930d05f603a16c3fd4daa681c 100644 >--- a/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >+++ b/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >@@ -37,6 +37,7 @@ > #include <WebCore/CaptureDevice.h> > #include <WebCore/ImageTransferSessionVT.h> > #include <WebCore/MediaConstraints.h> >+#include <WebCore/MockRealtimeMediaSourceCenter.h> > #include <WebCore/RealtimeMediaSourceCenter.h> > #include <WebCore/RemoteVideoSample.h> > #include <WebCore/WebAudioBufferList.h> >@@ -218,6 +219,10 @@ const char* UserMediaCaptureManager::supplementName() > > void UserMediaCaptureManager::initialize(const WebProcessCreationParameters& parameters) > { >+ MockRealtimeMediaSourceCenter::singleton().setMockAudioCaptureEnabled(!parameters.shouldCaptureAudioInUIProcess); >+ MockRealtimeMediaSourceCenter::singleton().setMockVideoCaptureEnabled(!parameters.shouldCaptureVideoInUIProcess); >+ MockRealtimeMediaSourceCenter::singleton().setMockDisplayCaptureEnabled(!parameters.shouldCaptureDisplayInUIProcess); >+ > if (parameters.shouldCaptureAudioInUIProcess) > RealtimeMediaSourceCenter::setAudioFactory(*this); > if (parameters.shouldCaptureVideoInUIProcess)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192544
: 356942