зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1672987 Use PipeWire when Wayland display is actually used, r=dminor
Right now PipeWire is enabled when Wayland session is used regardless of an active Gtk backend (X11/Wayland). Let's use PipeWire only when Wayland Gtk backend is used and disable it for X11 one to avoid possible regressions. Differential Revision: https://phabricator.services.mozilla.com/D94588
This commit is contained in:
Родитель
0c0c2f3994
Коммит
4422f81baa
|
@ -13,6 +13,11 @@
|
|||
#include "modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "modules/desktop_capture/desktop_capturer_differ_wrapper.h"
|
||||
|
||||
#if defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkx.h>
|
||||
#endif
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
DesktopCapturer::~DesktopCapturer() = default;
|
||||
|
@ -72,7 +77,19 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateTabCapturer(
|
|||
}
|
||||
|
||||
#if defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
||||
bool DesktopCapturer::IsRunningUnderWayland() {
|
||||
// Return true if Firefox is actually running with Wayland backend.
|
||||
static bool IsWaylandDisplayUsed() {
|
||||
const auto display = gdk_display_get_default();
|
||||
if (display == nullptr) {
|
||||
// We're running in headless mode.
|
||||
return false;
|
||||
}
|
||||
return !GDK_IS_X11_DISPLAY(display);
|
||||
}
|
||||
|
||||
// Return true if Firefox is actually running on Wayland enabled session.
|
||||
// It means some screensharing capabilities may be limited.
|
||||
static bool IsWaylandSessionUsed() {
|
||||
const char* xdg_session_type = getenv("XDG_SESSION_TYPE");
|
||||
if (!xdg_session_type || strncmp(xdg_session_type, "wayland", 7) != 0)
|
||||
return false;
|
||||
|
@ -82,6 +99,10 @@ bool DesktopCapturer::IsRunningUnderWayland() {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DesktopCapturer::IsRunningUnderWayland() {
|
||||
return IsWaylandSessionUsed() ? IsWaylandDisplayUsed() : false;
|
||||
}
|
||||
#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11)
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
Загрузка…
Ссылка в новой задаче