1 /* 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include "modules/desktop_capture/desktop_capture_options.h" 12 #include "modules/desktop_capture/desktop_capturer.h" 13 #include "modules/desktop_capture/win/window_capturer_win_gdi.h" 14 15 #if defined(RTC_ENABLE_WIN_WGC) 16 #include "modules/desktop_capture/blank_detector_desktop_capturer_wrapper.h" 17 #include "modules/desktop_capture/fallback_desktop_capturer_wrapper.h" 18 #include "modules/desktop_capture/win/wgc_capturer_win.h" 19 #include "rtc_base/win/windows_version.h" 20 #endif // defined(RTC_ENABLE_WIN_WGC) 21 22 namespace webrtc { 23 24 // static CreateRawWindowCapturer(const DesktopCaptureOptions & options)25std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer( 26 const DesktopCaptureOptions& options) { 27 std::unique_ptr<DesktopCapturer> capturer( 28 WindowCapturerWinGdi::CreateRawWindowCapturer(options)); 29 #if defined(RTC_ENABLE_WIN_WGC) 30 if (options.allow_wgc_capturer_fallback() && 31 rtc::rtc_win::GetVersion() >= rtc::rtc_win::Version::VERSION_WIN11) { 32 // BlankDectector capturer will send an error when it detects a failed 33 // GDI rendering, then Fallback capturer will try to capture it again with 34 // WGC. 35 capturer = std::make_unique<BlankDetectorDesktopCapturerWrapper>( 36 std::move(capturer), RgbaColor(0, 0, 0, 0), 37 /*check_per_capture*/ true); 38 39 capturer = std::make_unique<FallbackDesktopCapturerWrapper>( 40 std::move(capturer), 41 WgcCapturerWin::CreateRawWindowCapturer( 42 options, /*allow_delayed_capturable_check*/ true)); 43 } 44 #endif // defined(RTC_ENABLE_WIN_WGC) 45 return capturer; 46 } 47 48 } // namespace webrtc 49