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}
This commit is contained in:
Austin Orion 2021-08-17 14:21:47 -07:00 committed by WebRTC LUCI CQ
parent 209ac5fd95
commit 933afdf197
3 changed files with 8 additions and 2 deletions

View File

@ -79,7 +79,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
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)

View File

@ -207,8 +207,12 @@ Version MajorMinorBuildToVersion(int major, int minor, int build) {
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();

View File

@ -45,6 +45,8 @@ enum Version {
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.