Browse Source

chore: cherry-pick 2611772cf0a0 from chromium (#36517)

* chore: cherry-pick 2611772cf0a0 from chromium

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
Samuel Attard 2 years ago
parent
commit
dcce07dcd8
2 changed files with 45 additions and 0 deletions
  1. 1 0
      patches/chromium/.patches
  2. 44 0
      patches/chromium/cherry-pick-2611772cf0a0.patch

+ 1 - 0
patches/chromium/.patches

@@ -122,4 +122,5 @@ fix_remove_caption-removing_style_call.patch
 build_allow_electron_to_use_exec_script.patch
 cherry-pick-7196a42b42ce.patch
 fix_tray_icon_gone_on_lock_screen.patch
+cherry-pick-2611772cf0a0.patch
 cherry-pick-3235c1d1955b.patch

+ 44 - 0
patches/chromium/cherry-pick-2611772cf0a0.patch

@@ -0,0 +1,44 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Johannes Kron <[email protected]>
+Date: Mon, 28 Nov 2022 10:17:22 +0000
+Subject: Add feature for window capturing with ScreenCaptureKit
+
+Makes it possible to launch window capturing with
+ScreenCaptureKit individually.
+
+Bug: chromium:1352405
+Change-Id: Ie58d15007667db887ebf5f6f3092ef323f925461
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4047186
+Reviewed-by: Elad Alon <[email protected]>
+Commit-Queue: Johannes Kron <[email protected]>
+Cr-Commit-Position: refs/heads/main@{#1076120}
+
+diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
+index 4e510e5199a62e536542088e79c9b825225664fa..21d8f08c5d7abf414f0ecc7a909a87d9d5ce0513 100644
+--- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
++++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
+@@ -98,6 +98,13 @@ BASE_FEATURE(kDesktopCaptureMacV2,
+ BASE_FEATURE(kScreenCaptureKitMac,
+              "ScreenCaptureKitMac",
+              base::FEATURE_DISABLED_BY_DEFAULT);
++
++// If this feature is enabled, ScreenCaptureKit will be used for window
++// capturing even if kScreenCaptureKitMac is disabled. Please note that this
++// feature has no effect if kScreenCaptureKitMac is enabled.
++BASE_FEATURE(kScreenCaptureKitMacWindow,
++             "ScreenCaptureKitMacWindow",
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif
+ 
+ void IncrementDesktopCaptureCounters(const DesktopMediaID& device_id) {
+@@ -491,7 +498,9 @@ void InProcessVideoCaptureDeviceLauncher::DoStartDesktopCaptureOnDeviceThread(
+   // Prefer using ScreenCaptureKit. After that try DesktopCaptureDeviceMac, and
+   // if both fail, use the generic DesktopCaptureDevice.
+   if (!video_capture_device &&
+-      base::FeatureList::IsEnabled(kScreenCaptureKitMac)) {
++      (base::FeatureList::IsEnabled(kScreenCaptureKitMac) ||
++       (desktop_id.type == DesktopMediaID::TYPE_WINDOW &&
++        base::FeatureList::IsEnabled(kScreenCaptureKitMacWindow)))) {
+     if ((video_capture_device = CreateScreenCaptureKitDeviceMac(desktop_id)))
+       implementation = kScreenCaptureKitDeviceMac;
+   }