forked from electron/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: delete desktop capturers when they're not needed (electron#39194)
* fix: delete desktop capturers when they're not needed Delete desktop capturer objects by resetting the DesktopMediaList objects that own them after the sources have been collected. Capturers that are not delegated are already being reset via a patch on NativeDesktopMediaList. That is not safe for delegated capturers as thumbnail generation depends on user events. Deleting the DesktopMediaList operation is safe for all capturers and releases OS capture resources as soon as possible. * fix: add a patch to clean up PipeWire resources Adding a patch to workaround a Chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1467060 The patch can be removed when the issue is resolved.
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
fix_fallback_to_x11_capturer_on_wayland.patch | ||
fix_mark_pipewire_capturer_as_failed_after_session_is_closed.patch |
26 changes: 26 additions & 0 deletions
26
patches/webrtc/fix_mark_pipewire_capturer_as_failed_after_session_is_closed.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Athul Iddya <[email protected]> | ||
Date: Sat, 22 Jul 2023 11:11:01 -0700 | ||
Subject: fix: 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(). | ||
|
||
diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc | ||
index 4ef00e68ab58333648b8acaf4256f4b57a42734d..5a67c18c1d1f62aa5e3162d9778ca665bac4a1bb 100644 | ||
--- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc | ||
+++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc | ||
@@ -109,6 +109,7 @@ void BaseCapturerPipeWire::OnScreenCastRequestResult(RequestResponse result, | ||
void BaseCapturerPipeWire::OnScreenCastSessionClosed() { | ||
if (!capturer_failed_) { | ||
options_.screencast_stream()->StopScreenCastStream(); | ||
+ capturer_failed_ = true; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters