blob: f289746e3008633d58938833c84e55fd7e8dec0a [file] [log] [blame]
sergeyu@chromium.orgb10ccbe2013-05-19 07:02:481/*
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 Orion61c2d992020-07-08 22:09:0311#include "modules/desktop_capture/desktop_capture_options.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3112#include "modules/desktop_capture/desktop_capturer.h"
Austin Orion61c2d992020-07-08 22:09:0313#include "modules/desktop_capture/win/window_capturer_win_gdi.h"
sergeyu@chromium.orgb10ccbe2013-05-19 07:02:4814
Sunggook Chue347f9b02022-03-14 18:49:2515#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.orgb10ccbe2013-05-19 07:02:4822namespace webrtc {
23
sergeyu@chromium.orgb10ccbe2013-05-19 07:02:4824// static
zijiehe54fd5792016-11-02 21:49:3525std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
26 const DesktopCaptureOptions& options) {
Sunggook Chue347f9b02022-03-14 18:49:2527 std::unique_ptr<DesktopCapturer> capturer(
28 WindowCapturerWinGdi::CreateRawWindowCapturer(options));
29#if defined(RTC_ENABLE_WIN_WGC)
30 if (options.allow_wgc_capturer_fallback() &&
Sunggook Chue8a411c42022-04-12 22:45:4231 rtc::rtc_win::GetVersion() >= rtc::rtc_win::Version::VERSION_WIN11) {
Sunggook Chue347f9b02022-03-14 18:49:2532 // 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;
zijiehe54fd5792016-11-02 21:49:3546}
47
sergeyu@chromium.orgb10ccbe2013-05-19 07:02:4848} // namespace webrtc