Files
electron/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch
electron-roller[bot] ba135e2f7f chore: bump chromium to 144.0.7506.0 (main) (#48744)
* chore: bump chromium in DEPS to 144.0.7504.0

* chore: bump chromium in DEPS to 144.0.7506.0

* chore: update patches

* Revert "build: explicitly disable reclient"

This reverts commit e08c6adb08.

No longer needed after https://crrev.com/c/7099239

* 7097498: Remove MSG_ROUTING_* constants from ipc_message.h

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

* 7090671: [//gpu] Remove unneeded GpuInfo methods

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

* 7103701: Remove IPC::PlatformFileForTransit.

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

(This should have been removed with https://github.com/electron/electron/pull/17406).

* chore: update filenames.libcxx.gni

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-11-03 21:26:16 -08:00

59 lines
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Athul Iddya <athul@iddya.com>
Date: Fri, 14 Jul 2023 08:03:37 -0700
Subject: fix: use delegated generic capturer when available
When the generic capturer is used to fetch capture sources, the returned
ID will be arbitrarily prefixed with "screen" or "window" regardless of
the source type. If the window capturer is used to stream video when the
source was a screen or vice-versa, the stream fails to restart in
delegated capturers like PipeWire.
To fix this, use the generic capturer to fetch the media stream if it's
delegated and available. This does not cause any issues if the original
capturer was window or screen-specific, as the IDs remain valid for
generic capturer as well.
diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc
index 24eac68b596bc11af617d1a27b20d3e8e7ab742b..ac439cbae8cb45f8f7f423aa09651109b4d874fe 100644
--- a/content/browser/media/capture/desktop_capture_device.cc
+++ b/content/browser/media/capture/desktop_capture_device.cc
@@ -1007,9 +1007,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
switch (source.type) {
case DesktopMediaID::TYPE_SCREEN: {
- std::unique_ptr<webrtc::DesktopCapturer> screen_capturer(
- desktop_capture::CreateScreenCapturer(options,
- /*for_snapshot=*/false));
+ std::unique_ptr<webrtc::DesktopCapturer> screen_capturer;
+ if (auto generic_capturer =
+ webrtc::DesktopCapturer::CreateGenericCapturer(options);
+ generic_capturer &&
+ generic_capturer->GetDelegatedSourceListController()) {
+ screen_capturer = std::move(generic_capturer);
+ } else {
+ screen_capturer = desktop_capture::CreateScreenCapturer(
+ options, /*for_snapshot=*/false);
+ }
if (screen_capturer && screen_capturer->SelectSource(source.id)) {
capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
std::move(screen_capturer), options);
@@ -1026,8 +1033,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
}
case DesktopMediaID::TYPE_WINDOW: {
- std::unique_ptr<webrtc::DesktopCapturer> window_capturer =
- desktop_capture::CreateWindowCapturer(options);
+ std::unique_ptr<webrtc::DesktopCapturer> window_capturer;
+ if (auto generic_capturer =
+ webrtc::DesktopCapturer::CreateGenericCapturer(options);
+ generic_capturer &&
+ generic_capturer->GetDelegatedSourceListController()) {
+ window_capturer = std::move(generic_capturer);
+ } else {
+ window_capturer = desktop_capture::CreateWindowCapturer(options);
+ }
if (window_capturer && window_capturer->SelectSource(source.id)) {
capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
std::move(window_capturer), options);