Title: [271513] trunk/Source
Revision
271513
Author
[email protected]
Date
2021-01-15 01:45:56 -0800 (Fri, 15 Jan 2021)

Log Message

[GStreamer] UI<->WebPocess IPC needed for enumerateDevices support
https://bugs.webkit.org/show_bug.cgi?id=220542

Reviewed by Eric Carlson.

Source/WebCore:

* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::ensureGStreamerInitialized): Re-instate release assert ensuring this code path is
not hit from the UIProcess.

Source/WebKit:

For GLib ports the UIProcess will now send a message to the WebProcess to retrieve the
MediaStream devices. This is required because we want to avoid initializing GStreamer in the
UIProcess as much as possible.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::platformGetMediaStreamDevices):
(WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
* UIProcess/UserMediaPermissionRequestManagerProxy.h:
* UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::platformGetMediaStreamDevices):
* WebProcess/glib/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::validateUserMediaRequestConstraints):
(WebKit::UserMediaCaptureManager::getMediaStreamDevices):
* WebProcess/glib/UserMediaCaptureManager.h:
* WebProcess/glib/UserMediaCaptureManager.messages.in:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271512 => 271513)


--- trunk/Source/WebCore/ChangeLog	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebCore/ChangeLog	2021-01-15 09:45:56 UTC (rev 271513)
@@ -1,5 +1,16 @@
 2021-01-15  Philippe Normand  <[email protected]>
 
+        [GStreamer] UI<->WebPocess IPC needed for enumerateDevices support
+        https://bugs.webkit.org/show_bug.cgi?id=220542
+
+        Reviewed by Eric Carlson.
+
+        * platform/graphics/gstreamer/GStreamerCommon.cpp:
+        (WebCore::ensureGStreamerInitialized): Re-instate release assert ensuring this code path is
+        not hit from the UIProcess.
+
+2021-01-15  Philippe Normand  <[email protected]>
+
         [GStreamer] Clean-up the TextCombiner
         https://bugs.webkit.org/show_bug.cgi?id=220463
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp (271512 => 271513)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp	2021-01-15 09:45:56 UTC (rev 271513)
@@ -239,8 +239,7 @@
 
 bool ensureGStreamerInitialized()
 {
-    // FIXME: Re-enable this ASSERT when fixing https://bugs.webkit.org/show_bug.cgi?id=220542
-    // RELEASE_ASSERT(isInWebProcess());
+    RELEASE_ASSERT(isInWebProcess());
     static std::once_flag onceFlag;
     static bool isGStreamerInitialized;
     std::call_once(onceFlag, [] {

Modified: trunk/Source/WebKit/ChangeLog (271512 => 271513)


--- trunk/Source/WebKit/ChangeLog	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebKit/ChangeLog	2021-01-15 09:45:56 UTC (rev 271513)
@@ -1,3 +1,26 @@
+2021-01-15  Philippe Normand  <[email protected]>
+
+        [GStreamer] UI<->WebPocess IPC needed for enumerateDevices support
+        https://bugs.webkit.org/show_bug.cgi?id=220542
+
+        Reviewed by Eric Carlson.
+
+        For GLib ports the UIProcess will now send a message to the WebProcess to retrieve the
+        MediaStream devices. This is required because we want to avoid initializing GStreamer in the
+        UIProcess as much as possible.
+
+        * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
+        (WebKit::UserMediaPermissionRequestManagerProxy::platformGetMediaStreamDevices):
+        (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
+        * UIProcess/UserMediaPermissionRequestManagerProxy.h:
+        * UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp:
+        (WebKit::UserMediaPermissionRequestManagerProxy::platformGetMediaStreamDevices):
+        * WebProcess/glib/UserMediaCaptureManager.cpp:
+        (WebKit::UserMediaCaptureManager::validateUserMediaRequestConstraints):
+        (WebKit::UserMediaCaptureManager::getMediaStreamDevices):
+        * WebProcess/glib/UserMediaCaptureManager.h:
+        * WebProcess/glib/UserMediaCaptureManager.messages.in:
+
 2021-01-14  Peng Liu  <[email protected]>
 
         Add a quirk to disable "return to element fullscreen from picture-in-picture" for some sites

Modified: trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp (271512 => 271513)


--- trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp	2021-01-15 09:45:56 UTC (rev 271513)
@@ -508,7 +508,7 @@
     });
 }
 
-#if ENABLE(MEDIA_STREAM) && !USE(GLIB)
+#if !USE(GLIB)
 void UserMediaPermissionRequestManagerProxy::platformValidateUserMediaRequestConstraints(WebCore::RealtimeMediaSourceCenter::ValidConstraintsHandler&& validHandler, RealtimeMediaSourceCenter::InvalidConstraintsHandler&& invalidHandler, String&& deviceIDHashSalt)
 {
     RealtimeMediaSourceCenter::singleton().validateRequestConstraints(WTFMove(validHandler), WTFMove(invalidHandler), m_currentUserMediaRequest->userRequest(), WTFMove(deviceIDHashSalt));
@@ -659,12 +659,19 @@
     });
 }
 
+#if !USE(GLIB)
+void UserMediaPermissionRequestManagerProxy::platformGetMediaStreamDevices(CompletionHandler<void(Vector<WebCore::CaptureDevice>&&)>&& completionHandler)
+{
+    RealtimeMediaSourceCenter::singleton().getMediaStreamDevices(WTFMove(completionHandler));
+}
+#endif
+
 void UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList(bool revealIdsAndLabels, CompletionHandler<void(Vector<CaptureDevice>&&)>&& completion)
 {
     static const unsigned defaultMaximumCameraCount = 1;
     static const unsigned defaultMaximumMicrophoneCount = 1;
 
-    RealtimeMediaSourceCenter::singleton().getMediaStreamDevices([this, weakThis = makeWeakPtr(this), revealIdsAndLabels, completion = WTFMove(completion)] (auto&& devices) mutable {
+    platformGetMediaStreamDevices([this, weakThis = makeWeakPtr(this), revealIdsAndLabels, completion = WTFMove(completion)](auto&& devices) mutable {
         unsigned cameraCount = 0;
         unsigned microphoneCount = 0;
 

Modified: trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h (271512 => 271513)


--- trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h	2021-01-15 09:45:56 UTC (rev 271513)
@@ -121,6 +121,7 @@
     bool wasGrantedVideoOrAudioAccess(WebCore::FrameIdentifier, const WebCore::SecurityOrigin& userMediaDocumentOrigin, const WebCore::SecurityOrigin& topLevelDocumentOrigin);
 
     void computeFilteredDeviceList(bool revealIdsAndLabels, CompletionHandler<void(Vector<WebCore::CaptureDevice>&&)>&&);
+    void platformGetMediaStreamDevices(CompletionHandler<void(Vector<WebCore::CaptureDevice>&&)>&&);
 
     void processUserMediaPermissionRequest();
     void processUserMediaPermissionInvalidRequest(const String& invalidConstraint);

Modified: trunk/Source/WebKit/UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp (271512 => 271513)


--- trunk/Source/WebKit/UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebKit/UIProcess/glib/UserMediaPermissionRequestManagerProxyGLib.cpp	2021-01-15 09:45:56 UTC (rev 271513)
@@ -19,13 +19,9 @@
 #include "config.h"
 #include "UserMediaPermissionRequestManagerProxy.h"
 
-#include "DeviceIdHashSaltStorage.h"
-#include "Logging.h"
 #include "UserMediaCaptureManagerMessages.h"
 #include "WebPageProxy.h"
-#include "WebProcess.h"
 #include "WebProcessProxy.h"
-#include "WebsiteDataStore.h"
 #include <WebCore/UserMediaRequest.h>
 
 namespace WebKit {
@@ -41,4 +37,9 @@
     });
 }
 
+void UserMediaPermissionRequestManagerProxy::platformGetMediaStreamDevices(CompletionHandler<void(Vector<CaptureDevice>&&)>&& completionHandler)
+{
+    m_page.process().connection()->sendWithAsyncReply(Messages::UserMediaCaptureManager::GetMediaStreamDevices(), WTFMove(completionHandler));
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.cpp (271512 => 271513)


--- trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.cpp	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.cpp	2021-01-15 09:45:56 UTC (rev 271513)
@@ -51,7 +51,7 @@
 void UserMediaCaptureManager::validateUserMediaRequestConstraints(WebCore::MediaStreamRequest request, String hashSalt, ValidateUserMediaRequestConstraintsCallback&& completionHandler)
 {
     m_validateUserMediaRequestConstraintsCallback = WTFMove(completionHandler);
-    RealtimeMediaSourceCenter::InvalidConstraintsHandler invalidHandler = [this](const String& invalidConstraint) mutable {
+    auto invalidHandler = [this](const String& invalidConstraint) mutable {
         Vector<CaptureDevice> audioDevices;
         Vector<CaptureDevice> videoDevices;
         m_validateUserMediaRequestConstraintsCallback(invalidConstraint, audioDevices, videoDevices, { });
@@ -64,6 +64,11 @@
     RealtimeMediaSourceCenter::singleton().validateRequestConstraints(WTFMove(validHandler), WTFMove(invalidHandler), request, WTFMove(hashSalt));
 }
 
+void UserMediaCaptureManager::getMediaStreamDevices(GetMediaStreamDevicesCallback&& completionHandler)
+{
+    RealtimeMediaSourceCenter::singleton().getMediaStreamDevices(WTFMove(completionHandler));
 }
 
+}
+
 #endif

Modified: trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.h (271512 => 271513)


--- trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.h	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.h	2021-01-15 09:45:56 UTC (rev 271513)
@@ -42,6 +42,7 @@
 
 class UserMediaCaptureManager : public WebProcessSupplement, public IPC::MessageReceiver {
     WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_NONCOPYABLE(UserMediaCaptureManager);
 public:
     explicit UserMediaCaptureManager(WebProcess&);
     ~UserMediaCaptureManager();
@@ -57,6 +58,9 @@
     void validateUserMediaRequestConstraints(WebCore::MediaStreamRequest, String hashSalt, ValidateUserMediaRequestConstraintsCallback&&);
     ValidateUserMediaRequestConstraintsCallback m_validateUserMediaRequestConstraintsCallback;
 
+    using GetMediaStreamDevicesCallback = CompletionHandler<void(Vector<WebCore::CaptureDevice>&&)>;
+    void getMediaStreamDevices(GetMediaStreamDevicesCallback&&);
+
     WebProcess& m_process;
 };
 

Modified: trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.messages.in (271512 => 271513)


--- trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.messages.in	2021-01-15 09:27:06 UTC (rev 271512)
+++ trunk/Source/WebKit/WebProcess/glib/UserMediaCaptureManager.messages.in	2021-01-15 09:45:56 UTC (rev 271513)
@@ -25,6 +25,7 @@
 
 messages -> UserMediaCaptureManager NotRefCounted {
     ValidateUserMediaRequestConstraints(struct WebCore::MediaStreamRequest request, String hashSalt) -> (Optional<String> invalidConstraint, Vector<WebCore::CaptureDevice> audioDevices, Vector<WebCore::CaptureDevice> videoDevices, Optional<String> deviceIdentifierHashSalt) Async
+    GetMediaStreamDevices() -> (Vector<WebCore::CaptureDevice> devices) Async
 }
 
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to