|
|
d675653 |
|
|
|
d675653 |
# HG changeset patch
|
|
|
d675653 |
# User stransky <stransky@redhat.com>
|
|
|
d675653 |
# Date 1604562416 0
|
|
|
d675653 |
# Node ID 1c126b520042591194e88618ae11a6adc1da9a08
|
|
|
d675653 |
# Parent 6e2e4f0e4a95b0cae777dda9369a9e9bf49a51b1
|
|
|
d675653 |
Bug 1672987 Use PipeWire when Wayland display is actually used, r=dminor
|
|
|
d675653 |
|
|
|
d675653 |
Right now PipeWire is enabled when Wayland session is used regardless of an active Gtk backend (X11/Wayland).
|
|
|
d675653 |
Let's use PipeWire only when Wayland Gtk backend is used and disable it for X11 one to avoid possible regressions.
|
|
|
d675653 |
|
|
|
d675653 |
Differential Revision: https://phabricator.services.mozilla.com/D94588
|
|
|
d675653 |
|
|
|
d675653 |
diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capturer.cc b/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capturer.cc
|
|
|
d675653 |
--- a/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capturer.cc
|
|
|
d675653 |
+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capturer.cc
|
|
|
d675653 |
@@ -8,16 +8,21 @@
|
|
|
d675653 |
* be found in the AUTHORS file in the root of the source tree.
|
|
|
d675653 |
*/
|
|
|
d675653 |
|
|
|
d675653 |
#include "modules/desktop_capture/desktop_capturer.h"
|
|
|
d675653 |
|
|
|
d675653 |
#include "modules/desktop_capture/desktop_capture_options.h"
|
|
|
d675653 |
#include "modules/desktop_capture/desktop_capturer_differ_wrapper.h"
|
|
|
d675653 |
|
|
|
d675653 |
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
|
|
d675653 |
+#include <gtk/gtk.h>
|
|
|
d675653 |
+#include <gtk/gtkx.h>
|
|
|
d675653 |
+#endif
|
|
|
d675653 |
+
|
|
|
d675653 |
namespace webrtc {
|
|
|
d675653 |
|
|
|
d675653 |
DesktopCapturer::~DesktopCapturer() = default;
|
|
|
d675653 |
|
|
|
d675653 |
void DesktopCapturer::SetSharedMemoryFactory(
|
|
|
d675653 |
std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {}
|
|
|
d675653 |
|
|
|
d675653 |
void DesktopCapturer::SetExcludedWindow(WindowId window) {}
|
|
|
d675653 |
@@ -67,21 +72,37 @@ std::unique_ptr<DesktopCapturer> Desktop
|
|
|
d675653 |
if (capturer && options.detect_updated_region()) {
|
|
|
d675653 |
capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
|
|
|
d675653 |
}
|
|
|
d675653 |
|
|
|
d675653 |
return capturer;
|
|
|
d675653 |
}
|
|
|
d675653 |
|
|
|
d675653 |
#if defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
|
|
d675653 |
-bool DesktopCapturer::IsRunningUnderWayland() {
|
|
|
d675653 |
+// Return true if Firefox is actually running with Wayland backend.
|
|
|
d675653 |
+static bool IsWaylandDisplayUsed() {
|
|
|
d675653 |
+ const auto display = gdk_display_get_default();
|
|
|
d675653 |
+ if (display == nullptr) {
|
|
|
d675653 |
+ // We're running in headless mode.
|
|
|
d675653 |
+ return false;
|
|
|
d675653 |
+ }
|
|
|
d675653 |
+ return !GDK_IS_X11_DISPLAY(display);
|
|
|
d675653 |
+}
|
|
|
d675653 |
+
|
|
|
d675653 |
+// Return true if Firefox is actually running on Wayland enabled session.
|
|
|
d675653 |
+// It means some screensharing capabilities may be limited.
|
|
|
d675653 |
+static bool IsWaylandSessionUsed() {
|
|
|
d675653 |
const char* xdg_session_type = getenv("XDG_SESSION_TYPE");
|
|
|
d675653 |
if (!xdg_session_type || strncmp(xdg_session_type, "wayland", 7) != 0)
|
|
|
d675653 |
return false;
|
|
|
d675653 |
|
|
|
d675653 |
if (!(getenv("WAYLAND_DISPLAY")))
|
|
|
d675653 |
return false;
|
|
|
d675653 |
|
|
|
d675653 |
return true;
|
|
|
d675653 |
}
|
|
|
d675653 |
+
|
|
|
d675653 |
+bool DesktopCapturer::IsRunningUnderWayland() {
|
|
|
d675653 |
+ return IsWaylandSessionUsed() ? IsWaylandDisplayUsed() : false;
|
|
|
d675653 |
+}
|
|
|
d675653 |
#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
|
|
d675653 |
|
|
|
d675653 |
} // namespace webrtc
|
|
|
d675653 |
|