fix: desktop screen capture on macOS not releasing (#32435)

This commit is contained in:
Shelley Vohr 2022-01-13 16:21:28 +01:00 committed by GitHub
parent 6c88e3b8e7
commit 7f4efb6747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,7 +82,7 @@ index 1e4a652634fbde2ca9a256baca840bbc5a0e001f..546f5bc3a2f79035f0eec196d9e704b8
const Source& GetSource(int index) const override;
DesktopMediaList::Type GetMediaListType() const override;
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc
index 04dbc1f44944abd3333e83b603dcdf755c0cb09d..ab2dcc4d5fa19790114cae9611aa815e48386bb7 100644
index 04dbc1f44944abd3333e83b603dcdf755c0cb09d..d3a722f60c67d6177c3ca0bfc1329b87acf0b622 100644
--- a/chrome/browser/media/webrtc/native_desktop_media_list.cc
+++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc
@@ -17,7 +17,7 @@
@ -105,7 +105,17 @@ index 04dbc1f44944abd3333e83b603dcdf755c0cb09d..ab2dcc4d5fa19790114cae9611aa815e
#endif
} // namespace
@@ -435,6 +436,11 @@ void NativeDesktopMediaList::RefreshForVizFrameSinkWindows(
@@ -274,6 +275,9 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() {
FROM_HERE,
base::BindOnce(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished,
media_list_));
+
+ // This call is necessary to release underlying OS screen capture mechanisms.
+ capturer_.reset();
}
void NativeDesktopMediaList::Worker::OnCaptureResult(
@@ -435,6 +439,11 @@ void NativeDesktopMediaList::RefreshForVizFrameSinkWindows(
FROM_HERE, base::BindOnce(&Worker::RefreshThumbnails,
base::Unretained(worker_.get()),
std::move(native_ids), thumbnail_size_));