Reland "Begin implementing WGC CaptureFrame"
This reverts commit 61709a3233174618d5ab46e1ee5847e4b150c7ef.
Reason for revert: Some downstream projects have issues building this
change due to the inclusion of the <windows.graphics.capture.h> header
which is newly available in the Win 10 SDK v10.0.19041.
To get around this issue for now, this change adds an off-by-default
build flag for these files. However, in the future we will want to
toggle this flag on, and the downstream projects will either need to
update their SDK versions or toggle this flag in their WebRTC clone.
Original change's description:
> Revert "Begin implementing WGC CaptureFrame"
>
> This reverts commit e820cef5340610b9beebbcb63868743b95b97fcd.
>
> Reason for revert: Breaks downstream client. I will investigate and
> get back with a suggestion to fix.
>
> Original change's description:
> > Begin implementing WGC CaptureFrame
> >
> > This change introduces the design that will allow us to deliver frames
> > synchronously to callers despite the Windows.Graphics.Capture APIs being
> > inherently asynchronous.
> >
> > We achieve this by having WindowCapturerWinWgc create and maintain a
> > WgcCaptureSession object for each window that it is asked to capture a
> > frame for. The capture session object will be the class that actually
> > uses the WGC APIs, and it will store the frames it receives in a frame
> > pool and deliver them via GetMostRecentFrame.
> >
> > The next CL will add the necessary functionality to the
> > WgcCaptureSession class.
> >
> > Bug: webrtc:9273
> > Change-Id: I44e164f4874503d8ccc8e6a210e74f9c8458f6c4
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184220
> > Commit-Queue: Austin Orion <auorion@microsoft.com>
> > Reviewed-by: Tommi <tommi@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#32240}
>
> TBR=mbonadei@webrtc.org,jamiewalch@chromium.org,tommi@webrtc.org,auorion@microsoft.com
>
> Change-Id: I114944357ce5be7d1e2da817703dc95d544aa99a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:9273
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186045
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32248}
Bug: webrtc:9273
Change-Id: I9644fbf8f1fd1a84cb716176b8f14e3683a3f7cb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186423
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32286}
diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
index 61926a6..e1fff4e 100644
--- a/modules/desktop_capture/desktop_capturer.cc
+++ b/modules/desktop_capture/desktop_capturer.cc
@@ -20,6 +20,13 @@
#include "modules/desktop_capture/desktop_capture_options.h"
#include "modules/desktop_capture/desktop_capturer_differ_wrapper.h"
+#if defined(RTC_ENABLE_WIN_WGC)
+#include "modules/desktop_capture/win/window_capturer_win_wgc.h"
+#include "rtc_base/win/windows_version.h"
+
+const bool kUseWinWgcCapturer = false;
+#endif // defined(RTC_ENABLE_WIN_WGC)
+
namespace webrtc {
DesktopCapturer::~DesktopCapturer() = default;
@@ -48,6 +55,16 @@
// static
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
const DesktopCaptureOptions& options) {
+#if defined(RTC_ENABLE_WIN_WGC)
+ // TODO(bugs.webrtc.org/11760): Add a WebRTC field trial (or similar
+ // mechanism) check here that leads to use of the WGC capturer once it is
+ // fully implemented.
+ if (kUseWinWgcCapturer &&
+ rtc::rtc_win::GetVersion() >= rtc::rtc_win::Version::VERSION_WIN10_RS5) {
+ return WindowCapturerWinWgc::CreateRawWindowCapturer(options);
+ }
+#endif // defined(RTC_ENABLE_WIN_WGC)
+
#if defined(WEBRTC_WIN)
if (options.allow_cropping_window_capturer()) {
return CroppingWindowCapturer::CreateCapturer(options);