Restrict WGC screen capture to Windows version 20H1 and greater.
The Windows.Graphics.Capture API CreateForMonitor has a bug that was
fixed in 20H1 that causes an exception to be thrown when an HMONITOR
with a value of 0 is provided. This is a valid input used to request
capture of all monitors. To avoid this issue, we can restrict screen
capture using WGC to versions of Windows >=20H1.
Bug: webrtc:13078
Change-Id: Ia66bf2b2738c29813d41e214fdfc1eb96e0a1312
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229140
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Austin Orion <auorion@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#34878}
diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
index 735aa4d..9e6b99a 100644
--- a/modules/desktop_capture/desktop_capturer.cc
+++ b/modules/desktop_capture/desktop_capturer.cc
@@ -79,7 +79,7 @@
const DesktopCaptureOptions& options) {
#if defined(RTC_ENABLE_WIN_WGC)
if (options.allow_wgc_capturer() &&
- rtc::rtc_win::GetVersion() >= rtc::rtc_win::Version::VERSION_WIN10_RS5) {
+ rtc::rtc_win::GetVersion() >= rtc::rtc_win::Version::VERSION_WIN10_20H1) {
return WgcCapturerWin::CreateRawScreenCapturer(options);
}
#endif // defined(RTC_ENABLE_WIN_WGC)
diff --git a/rtc_base/win/windows_version.cc b/rtc_base/win/windows_version.cc
index dab61ae..0ed8957 100644
--- a/rtc_base/win/windows_version.cc
+++ b/rtc_base/win/windows_version.cc
@@ -207,8 +207,12 @@
return VERSION_WIN10_RS4;
} else if (build < 18362) {
return VERSION_WIN10_RS5;
- } else {
+ } else if (build < 18363) {
return VERSION_WIN10_19H1;
+ } else if (build < 19041) {
+ return VERSION_WIN10_19H2;
+ } else {
+ return VERSION_WIN10_20H1;
}
} else if (major > 6) {
RTC_NOTREACHED();
diff --git a/rtc_base/win/windows_version.h b/rtc_base/win/windows_version.h
index 33449e2..dbb0d8e 100644
--- a/rtc_base/win/windows_version.h
+++ b/rtc_base/win/windows_version.h
@@ -45,6 +45,8 @@
VERSION_WIN10_RS4 = 12, // Redstone 4: Version 1803, Build 17134.
VERSION_WIN10_RS5 = 13, // Redstone 5: Version 1809, Build 17763.
VERSION_WIN10_19H1 = 14, // 19H1: Version 1903, Build 18362.
+ VERSION_WIN10_19H2 = 15, // 19H2: Version 1909, Build 18363.
+ VERSION_WIN10_20H1 = 16, // 20H1 (Vibranium): Version 2004, Build 19041.
// On edit, update tools\metrics\histograms\enums.xml "WindowsVersion" and
// "GpuBlacklistFeatureTestResultsWindows2".
VERSION_WIN_LAST, // Indicates error condition.