Browse Source

fix: check PipeWire init before creating generic capturer (#39846)

Check if PipeWire can be initialized before creating generic capturer.
This harmonizes the conditions with the ones used in Linux
implementations of DesktopCapturer::CreateRawScreenCapturer and
DesktopCapturer::CreateRawWindowCapturer.
Athul Iddya 1 year ago
parent
commit
50ce02c312

+ 1 - 0
patches/webrtc/.patches

@@ -1,2 +1,3 @@
 fix_fallback_to_x11_capturer_on_wayland.patch
 fix_mark_pipewire_capturer_as_failed_after_session_is_closed.patch
+fix_check_pipewire_init_before_creating_generic_capturer.patch

+ 23 - 0
patches/webrtc/fix_check_pipewire_init_before_creating_generic_capturer.patch

@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Athul Iddya <[email protected]>
+Date: Tue, 12 Sep 2023 22:19:46 -0700
+Subject: fix: check PipeWire init before creating generic capturer
+
+Check if PipeWire can be initialized before creating generic capturer.
+This harmonizes the conditions with the ones used in Linux
+implementations of DesktopCapturer::CreateRawScreenCapturer and
+DesktopCapturer::CreateRawWindowCapturer.
+
+diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
+index a52a76c2625cf0a2eae7ab5b841e0bf4ff499d88..099313bc1b4e75ebbe62c30190a068f68bfe5366 100644
+--- a/modules/desktop_capture/desktop_capturer.cc
++++ b/modules/desktop_capture/desktop_capturer.cc
+@@ -113,7 +113,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer(
+   std::unique_ptr<DesktopCapturer> capturer;
+ 
+ #if defined(WEBRTC_USE_PIPEWIRE)
+-  if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
++  if (options.allow_pipewire() && BaseCapturerPipeWire::IsSupported()) {
+     capturer = std::make_unique<BaseCapturerPipeWire>(
+         options, CaptureType::kAnyScreenContent);
+   }