Splits AllowWgcDesktopCapturer into AllowWgc[Window/Screen]Capturer flags

This CL allows the users to now enable/disable WGC capturing support
for Window and Screen sharing independently.

Bug: chromium:1314868
Change-Id: Ieeb15539434dac2caf29c515aa7c5dbb7abcc5df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/309560
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40330}
This commit is contained in:
henrika 2023-06-21 17:07:55 +02:00 committed by WebRTC LUCI CQ
parent 5246ae20a2
commit c3a74024bf
2 changed files with 22 additions and 5 deletions

View File

@ -159,15 +159,28 @@ class RTC_EXPORT DesktopCaptureOptions {
}
#if defined(RTC_ENABLE_WIN_WGC)
// This flag enables the WGC capturer for both window and screen capture.
// TODO(henrika): to be removed.
bool allow_wgc_capturer() const { return allow_wgc_capturer_; }
void set_allow_wgc_capturer(bool allow) { allow_wgc_capturer_ = allow; }
// This flag enables the WGC capturer for capturing the screen.
// This capturer should offer similar or better performance than the cropping
// capturer without the disadvantages listed above. However, the WGC capturer
// is only available on Windows 10 version 1809 (Redstone 5) and up. This flag
// will have no affect on older versions.
// If set, and running a supported version of Win10, this flag will take
// precedence over the cropping, directx, and magnification flags.
bool allow_wgc_capturer() const { return allow_wgc_capturer_; }
void set_allow_wgc_capturer(bool allow) { allow_wgc_capturer_ = allow; }
bool allow_wgc_screen_capturer() const { return allow_wgc_screen_capturer_; }
void set_allow_wgc_screen_capturer(bool allow) {
allow_wgc_screen_capturer_ = allow;
}
// This flag has the same effect as allow_wgc_screen_capturer but it only
// enables or disables WGC for window capturing (not screen).
bool allow_wgc_window_capturer() const { return allow_wgc_window_capturer_; }
void set_allow_wgc_window_capturer(bool allow) {
allow_wgc_window_capturer_ = allow;
}
// This flag enables the WGC capturer for fallback capturer.
// The flag is useful when the first capturer (eg. WindowCapturerWinGdi) is
@ -236,6 +249,8 @@ class RTC_EXPORT DesktopCaptureOptions {
bool allow_cropping_window_capturer_ = false;
#if defined(RTC_ENABLE_WIN_WGC)
bool allow_wgc_capturer_ = false;
bool allow_wgc_screen_capturer_ = false;
bool allow_wgc_window_capturer_ = false;
bool allow_wgc_capturer_fallback_ = false;
bool allow_wgc_zero_hertz_ = false;
#endif

View File

@ -65,7 +65,8 @@ bool DesktopCapturer::IsOccluded(const DesktopVector& pos) {
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
const DesktopCaptureOptions& options) {
#if defined(RTC_ENABLE_WIN_WGC)
if (options.allow_wgc_capturer() && IsWgcSupported(CaptureType::kWindow)) {
if ((options.allow_wgc_capturer() || options.allow_wgc_window_capturer()) &&
IsWgcSupported(CaptureType::kWindow)) {
return WgcCapturerWin::CreateRawWindowCapturer(options);
}
#endif // defined(RTC_ENABLE_WIN_WGC)
@ -88,7 +89,8 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
const DesktopCaptureOptions& options) {
#if defined(RTC_ENABLE_WIN_WGC)
if (options.allow_wgc_capturer() && IsWgcSupported(CaptureType::kScreen)) {
if ((options.allow_wgc_capturer() || options.allow_wgc_screen_capturer()) &&
IsWgcSupported(CaptureType::kScreen)) {
return WgcCapturerWin::CreateRawScreenCapturer(options);
}
#endif // defined(RTC_ENABLE_WIN_WGC)