Title: [280292] trunk/Source/WebCore
Revision
280292
Author
[email protected]
Date
2021-07-26 02:50:44 -0700 (Mon, 26 Jul 2021)

Log Message

[Pipewire] Muting the display capture closes the Portal session
https://bugs.webkit.org/show_bug.cgi?id=228265

Patch by Philippe Normand <[email protected]> on 2021-07-26
Reviewed by Xabier Rodriguez-Calvar.

The session should not be closed in that case, because setting the capture state to active
again would have no effect. This patch also removes useless CRLFs from WTFLogAlways() calls
and increases the session Close call timeout to 100ms, 10ms was too low, at least for my
setup.

* platform/mediastream/gstreamer/GStreamerDisplayCaptureDeviceManager.cpp:
(WebCore::GStreamerDisplayCaptureDeviceManager::createDisplayCaptureSource):
(WebCore::GStreamerDisplayCaptureDeviceManager::stopSource):
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
(WebCore::GStreamerVideoCaptureSource::~GStreamerVideoCaptureSource):
(WebCore::GStreamerVideoCaptureSource::stopProducingData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280291 => 280292)


--- trunk/Source/WebCore/ChangeLog	2021-07-26 07:48:44 UTC (rev 280291)
+++ trunk/Source/WebCore/ChangeLog	2021-07-26 09:50:44 UTC (rev 280292)
@@ -1,3 +1,22 @@
+2021-07-26  Philippe Normand  <[email protected]>
+
+        [Pipewire] Muting the display capture closes the Portal session
+        https://bugs.webkit.org/show_bug.cgi?id=228265
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The session should not be closed in that case, because setting the capture state to active
+        again would have no effect. This patch also removes useless CRLFs from WTFLogAlways() calls
+        and increases the session Close call timeout to 100ms, 10ms was too low, at least for my
+        setup.
+
+        * platform/mediastream/gstreamer/GStreamerDisplayCaptureDeviceManager.cpp:
+        (WebCore::GStreamerDisplayCaptureDeviceManager::createDisplayCaptureSource):
+        (WebCore::GStreamerDisplayCaptureDeviceManager::stopSource):
+        * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
+        (WebCore::GStreamerVideoCaptureSource::~GStreamerVideoCaptureSource):
+        (WebCore::GStreamerVideoCaptureSource::stopProducingData):
+
 2021-07-26  Ziran Sun  <[email protected]>
 
         [css-grid] svg image as grid items should use the overriding logical width/height when defined to compute the logical height/width

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerDisplayCaptureDeviceManager.cpp (280291 => 280292)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerDisplayCaptureDeviceManager.cpp	2021-07-26 07:48:44 UTC (rev 280291)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerDisplayCaptureDeviceManager.cpp	2021-07-26 09:50:44 UTC (rev 280292)
@@ -72,7 +72,7 @@
         static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES), nullptr,
         "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop", "org.freedesktop.portal.ScreenCast", nullptr, &error.outPtr()));
     if (error) {
-        WTFLogAlways("Unable to connect to the Deskop portal: %s\n", error->message);
+        WTFLogAlways("Unable to connect to the Deskop portal: %s", error->message);
         return { };
     }
 
@@ -86,7 +86,7 @@
     auto result = adoptGRef(g_dbus_proxy_call_sync(m_proxy.get(), "CreateSession", g_variant_new("(a{sv})", &options),
         G_DBUS_CALL_FLAGS_NONE, s_dbusCallTimeout.millisecondsAs<int>(), nullptr, &error.outPtr()));
     if (error) {
-        WTFLogAlways("Unable to create a Deskop portal session: %s\n", error->message);
+        WTFLogAlways("Unable to create a Deskop portal session: %s", error->message);
         return { };
     }
 
@@ -121,7 +121,7 @@
     result = adoptGRef(g_dbus_proxy_call_sync(m_proxy.get(), "SelectSources",
         g_variant_new("(oa{sv})", sessionPath.ascii().data(), &options), G_DBUS_CALL_FLAGS_NONE, s_dbusCallTimeout.millisecondsAs<int>(), nullptr, &error.outPtr()));
     if (error) {
-        WTFLogAlways("SelectSources error: %s\n", error->message);
+        WTFLogAlways("SelectSources error: %s", error->message);
         return { };
     }
     g_variant_get(result.get(), "(o)", &objectPath.outPtr());
@@ -133,7 +133,7 @@
     result = adoptGRef(g_dbus_proxy_call_sync(m_proxy.get(), "Start",
         g_variant_new("(osa{sv})", sessionPath.ascii().data(), "", &options), G_DBUS_CALL_FLAGS_NONE, s_dbusCallTimeout.millisecondsAs<int>(), nullptr, &error.outPtr()));
     if (error) {
-        WTFLogAlways("Start error: %s\n", error->message);
+        WTFLogAlways("Start error: %s", error->message);
         return { };
     }
 
@@ -167,13 +167,14 @@
         static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES), nullptr,
         "org.freedesktop.portal.Desktop", session->path.ascii().data(), "org.freedesktop.portal.Session", nullptr, &error.outPtr()));
     if (error) {
-        WTFLogAlways("Unable to connect to the Deskop portal: %s\n", error->message);
+        WTFLogAlways("Unable to connect to the Deskop portal: %s", error->message);
         return;
     }
+    auto dbusCallTimeout = 100_ms;
     auto result = adoptGRef(g_dbus_proxy_call_sync(proxy.get(), "Close", nullptr, G_DBUS_CALL_FLAGS_NONE,
-        s_dbusCallTimeout.millisecondsAs<int>(), nullptr, &error.outPtr()));
+        dbusCallTimeout.millisecondsAs<int>(), nullptr, &error.outPtr()));
     if (error)
-        WTFLogAlways("Portal session could not be closed: %s\n", error->message);
+        WTFLogAlways("Portal session could not be closed: %s", error->message);
 }
 
 void GStreamerDisplayCaptureDeviceManager::waitResponseSignal(const char* objectPath)

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp (280291 => 280292)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp	2021-07-26 07:48:44 UTC (rev 280291)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp	2021-07-26 09:50:44 UTC (rev 280292)
@@ -144,6 +144,11 @@
         return;
     g_signal_handlers_disconnect_by_func(m_capturer->sink(), reinterpret_cast<gpointer>(newSampleCallback), this);
     m_capturer->stop();
+
+    if (auto fd = m_capturer->pipewireFD()) {
+        auto& manager = GStreamerDisplayCaptureDeviceManager::singleton();
+        manager.stopSource(persistentID());
+    }
 }
 
 void GStreamerVideoCaptureSource::settingsDidChange(OptionSet<RealtimeMediaSourceSettings::Flag> settings)
@@ -204,11 +209,6 @@
 {
     GST_INFO("Reset height and width after stopping source");
     setSize({ 0, 0 });
-
-    if (auto fd = m_capturer->pipewireFD()) {
-        auto& manager = GStreamerDisplayCaptureDeviceManager::singleton();
-        manager.stopSource(persistentID());
-    }
 }
 
 const RealtimeMediaSourceCapabilities& GStreamerVideoCaptureSource::capabilities()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to