Skip to content

Commit fc4dffd

Browse files
author
Anu Aliyas
committed
Use ScreenCaptureKit for macOS 13.2 and later
A stable ScreenCaptureKit support is available starting from macOS 13.2. Due to compilation issues on older macOS version, QtWebEngine was not using this feature. A gn argument use_sck is added to handle the compile time version check. This will be set while configuring the QtWebEngine. Change-Id: I9112f0bce6292ccb9215821c951d968997ac4367 Task-number: QTBUG-127797 Pick-to: 118-based Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/585455 Reviewed-by: Martin Negyokru <[email protected]> Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent 0e21ef3 commit fc4dffd

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

chromium/content/browser/BUILD.gn

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,16 +2818,14 @@ jumbo_source_set("browser") {
28182818
frameworks += [ "CoreMedia.framework" ]
28192819
weak_frameworks += [ "ScreenCaptureKit.framework" ] # macOS 12.3
28202820

2821-
if (is_qtwebengine) {
2821+
if (!use_sck) {
28222822
sources -= [
28232823
"media/capture/screen_capture_kit_device_mac.h",
28242824
"media/capture/screen_capture_kit_device_mac.mm",
28252825
"media/capture/screen_capture_kit_fullscreen_module.h",
28262826
"media/capture/screen_capture_kit_fullscreen_module.mm",
28272827
]
2828-
28292828
weak_frameworks -= [ "ScreenCaptureKit.framework" ] # macOS 12.3
2830-
28312829
}
28322830
}
28332831
if (is_chromeos_ash) {

chromium/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@
4848
#endif // BUILDFLAG(ENABLE_WEBRTC)
4949
#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
5050
#if BUILDFLAG(IS_MAC)
51+
#include "base/mac/mac_util.h"
5152
#include "content/browser/media/capture/desktop_capture_device_mac.h"
53+
#if BUILDFLAG(USE_SCK)
5254
#include "content/browser/media/capture/screen_capture_kit_device_mac.h"
55+
#endif // BUILDFLAG(USE_SCK)
5356
#include "content/browser/media/capture/views_widget_video_capture_device_mac.h"
5457
#endif
5558
#if BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -194,7 +197,9 @@ DesktopCaptureImplementation CreatePlatformDependentVideoCaptureDevice(
194197
#if BUILDFLAG(IS_MAC)
195198
// Prefer using ScreenCaptureKit. After that try DesktopCaptureDeviceMac, and
196199
// if both fail, use the generic DesktopCaptureDevice.
197-
#if !BUILDFLAG(IS_QTWEBENGINE)
200+
// Although ScreenCaptureKit is available in 12.3 there were some bugs that
201+
// were not fixed until 13.2
202+
#if BUILDFLAG(USE_SCK)
198203
// ### Requires macOS sdk 12.3:
199204
if (base::FeatureList::IsEnabled(kScreenCaptureKitMac) ||
200205
(desktop_id.type == DesktopMediaID::TYPE_WINDOW &&
@@ -204,7 +209,7 @@ DesktopCaptureImplementation CreatePlatformDependentVideoCaptureDevice(
204209
if ((device_out = CreateScreenCaptureKitDeviceMac(desktop_id)))
205210
return kScreenCaptureKitDeviceMac;
206211
}
207-
#endif // !BUILDFLAG(IS_QTWEBENGINE)
212+
#endif //BUILDFLAG(USE_SCK)
208213
if ((device_out = CreateDesktopCaptureDeviceMac(desktop_id))) {
209214
return kDesktopCaptureDeviceMac;
210215
}

chromium/media/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ buildflag_header("media_buildflags") {
6767
"USE_CHROMEOS_PROTECTED_AV1=$use_chromeos_protected_av1",
6868
"USE_CHROMEOS_PROTECTED_MEDIA=$use_chromeos_protected_media",
6969
"USE_PROPRIETARY_CODECS=$proprietary_codecs",
70+
"USE_SCK=$use_sck",
7071
]
7172

7273
if (enable_library_cdms) {

chromium/media/media_options.gni

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ declare_args() {
129129
# Enable inclusion of VVC/H.266 parser/demuxer, and also enable VVC/H.266 decoding
130130
# with hardware acceleration provided by platform. Disabled by default for all builds.
131131
enable_platform_vvc = false
132+
133+
# Enable the use of ScreenCaptureKit framework on macOS. A stable ScreenCaptureKit is available
134+
# from macOS 13.2. Enabled by default for all build.
135+
use_sck = true
132136
}
133137

134138
# Use another declare_args() to allow dependence on args defined above.

0 commit comments

Comments
 (0)