sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 | [diff] [blame] | 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 | |
Austin Orion | 61c2d99 | 2020-07-08 22:09:03 | [diff] [blame] | 11 | #include "modules/desktop_capture/desktop_capture_options.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 12 | #include "modules/desktop_capture/desktop_capturer.h" |
Austin Orion | 61c2d99 | 2020-07-08 22:09:03 | [diff] [blame] | 13 | #include "modules/desktop_capture/win/window_capturer_win_gdi.h" |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 | [diff] [blame] | 14 | |
Sunggook Chue | 347f9b0 | 2022-03-14 18:49:25 | [diff] [blame] | 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 | |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 | [diff] [blame] | 22 | namespace webrtc { |
| 23 | |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 | [diff] [blame] | 24 | // static |
zijiehe | 54fd579 | 2016-11-02 21:49:35 | [diff] [blame] | 25 | std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer( |
| 26 | const DesktopCaptureOptions& options) { |
Sunggook Chue | 347f9b0 | 2022-03-14 18:49:25 | [diff] [blame] | 27 | std::unique_ptr<DesktopCapturer> capturer( |
| 28 | WindowCapturerWinGdi::CreateRawWindowCapturer(options)); |
| 29 | #if defined(RTC_ENABLE_WIN_WGC) |
| 30 | if (options.allow_wgc_capturer_fallback() && |
Sunggook Chue | 8a411c4 | 2022-04-12 22:45:42 | [diff] [blame] | 31 | rtc::rtc_win::GetVersion() >= rtc::rtc_win::Version::VERSION_WIN11) { |
Sunggook Chue | 347f9b0 | 2022-03-14 18:49:25 | [diff] [blame] | 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; |
zijiehe | 54fd579 | 2016-11-02 21:49:35 | [diff] [blame] | 46 | } |
| 47 | |
sergeyu@chromium.org | b10ccbe | 2013-05-19 07:02:48 | [diff] [blame] | 48 | } // namespace webrtc |