mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: delete desktop capturers when they're not needed (#39246)
* 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. Co-authored-by: Athul Iddya <athul@iddya.com> * 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. Co-authored-by: Athul Iddya <athul@iddya.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Athul Iddya <athul@iddya.com>
This commit is contained in:
@@ -372,6 +372,9 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
|
||||
v8::HandleScope scope(isolate);
|
||||
gin_helper::CallMethod(this, "_onfinished", captured_sources_);
|
||||
|
||||
screen_capturer_.reset();
|
||||
window_capturer_.reset();
|
||||
|
||||
Unpin();
|
||||
}
|
||||
}
|
||||
@@ -381,6 +384,9 @@ void DesktopCapturer::HandleFailure() {
|
||||
v8::HandleScope scope(isolate);
|
||||
gin_helper::CallMethod(this, "_onerror", "Failed to get sources.");
|
||||
|
||||
screen_capturer_.reset();
|
||||
window_capturer_.reset();
|
||||
|
||||
Unpin();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user