Files
electron/patches/webrtc/fix_handle_pipewire_capturer_initialization_and_management.patch
electron-roller[bot] 471a14432f chore: bump chromium to 143.0.7469.0 (main) (#48548)
* chore: bump chromium in DEPS to 143.0.7469.0

* 7021651: [//gpu] Fold handle creation into D3DImageBackingFactory

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7021651

* 7013047: Fix various C++23 build errors in //chrome

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7013047

* 7010850: [//ui] Port screen_mac.mm's calls to DisplayColorSpaces

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7010850

* 7007933: Remove superfluous mojom includes in //content/public headers

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7007933

* 7023196: Trim os_crypt/sync visibility list

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7023196

* 7008912: Remove GURL::*_piece() method

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7008912

* 7003989: Add wrapper struct for CopyFromSurface output

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7003989

* 7017889: [MemoryPressureListener] Remove type aliases

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7017889

* 7027780: Delete viz::ResourceSizes

Refs https://chromium-review.googlesource.com/c/chromium/src/+/7027780
Refs https://chromium-review.googlesource.com/c/chromium/src/+/6989572

* 6495189: [api] Delete old String::Write* APIs

Refs https://chromium-review.googlesource.com/c/v8/v8/+/6495189

* chore: update patches

* chore: run script/gen-libc++-filenames.js

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2025-10-15 14:10:10 -07:00

101 lines
4.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Athul Iddya <athul@iddya.com>
Date: Tue, 12 Sep 2023 22:19:46 -0700
Subject: fix: Handle PipeWire capturer initialization and management
This patch handles several fixes related to PipeWire capturer initialization
and management.
1. Mark PipeWire capturer as failed after session is closed
After a PipeWire screencast session is successfully started, the
consumer is expected to keep calling CaptureFrame() from the
DesktopCapturer interface in a loop to pull frames. A PipeWire
screencast session can be closed by the server on user action. Once the
session is closed, there's no point in calling CaptureFrame() again as
the capture has to be restarted. Inform the caller of the failure by
returning Result::ERROR_PERMANENT on the next invocation of
CaptureFrame().
2. 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.
3. Establishes fallback to X11 capturer when PipeWire fails to start
CL: https://webrtc-review.googlesource.com/c/src/+/279163
Desktop Capturer behaves inconsistently on Wayland. PipeWire does not
always successfully start; if it does not, we return a nullptr rather
than falling back on the X11 capturer, crashing the application. If the
X11 capturer is enabled, we should at minimum try to fallback to X11
for desktop capturer. This change re-enables that fallback, which was
previously default behavior.
diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
index bf63f73178688e49286bb6686d5a42ce040c663e..f5f62a2b7865d8415ec08242312df006bcb2edf5 100644
--- a/modules/desktop_capture/desktop_capturer.cc
+++ b/modules/desktop_capture/desktop_capturer.cc
@@ -138,7 +138,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);
}
diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
index 361b465dad2a53f4dac774fa2d6d6d9e3fc5fc31..ef05a35bc4f2c2352b12c0af0b09193b6cd53244 100644
--- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
+++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
@@ -123,6 +123,7 @@ void BaseCapturerPipeWire::OnScreenCastRequestResult(RequestResponse result,
void BaseCapturerPipeWire::OnScreenCastSessionClosed() {
if (!capturer_failed_) {
options_.screencast_stream()->StopScreenCastStream();
+ capturer_failed_ = true;
}
capturer_failed_ = true;
}
diff --git a/modules/desktop_capture/screen_capturer_linux.cc b/modules/desktop_capture/screen_capturer_linux.cc
index f25e08fb594c563b1f8ca0fd1c4383ed39df5149..8ce6a9d82d808c1618b857ac83af85ac38a43a2a 100644
--- a/modules/desktop_capture/screen_capturer_linux.cc
+++ b/modules/desktop_capture/screen_capturer_linux.cc
@@ -39,11 +39,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
#endif // defined(WEBRTC_USE_PIPEWIRE)
#if defined(WEBRTC_USE_X11)
- if (!DesktopCapturer::IsRunningUnderWayland())
- return ScreenCapturerX11::CreateRawScreenCapturer(options);
-#endif // defined(WEBRTC_USE_X11)
-
+ return ScreenCapturerX11::CreateRawScreenCapturer(options);
+#else
return nullptr;
+#endif // defined(WEBRTC_USE_X11)
}
} // namespace webrtc
diff --git a/modules/desktop_capture/window_capturer_linux.cc b/modules/desktop_capture/window_capturer_linux.cc
index 87ea3d57212c5f62194f206787756b7f3fb63e90..3f565ab13a033dc29d55f819da7de464b6e19885 100644
--- a/modules/desktop_capture/window_capturer_linux.cc
+++ b/modules/desktop_capture/window_capturer_linux.cc
@@ -39,11 +39,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
#endif // defined(WEBRTC_USE_PIPEWIRE)
#if defined(WEBRTC_USE_X11)
- if (!DesktopCapturer::IsRunningUnderWayland())
- return WindowCapturerX11::CreateRawWindowCapturer(options);
-#endif // defined(WEBRTC_USE_X11)
-
+ return WindowCapturerX11::CreateRawWindowCapturer(options);
+#else
return nullptr;
+#endif // defined(WEBRTC_USE_X11)
}
} // namespace webrtc