diff --git a/modules/desktop_capture/desktop_capture_options.h b/modules/desktop_capture/desktop_capture_options.h index 775531081b..9796b5fca2 100644 --- a/modules/desktop_capture/desktop_capture_options.h +++ b/modules/desktop_capture/desktop_capture_options.h @@ -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 diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc index 5211f1acec..2017c60670 100644 --- a/modules/desktop_capture/desktop_capturer.cc +++ b/modules/desktop_capture/desktop_capturer.cc @@ -65,7 +65,8 @@ bool DesktopCapturer::IsOccluded(const DesktopVector& pos) { std::unique_ptr 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::CreateWindowCapturer( std::unique_ptr 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)