From 8a411c4e2c1fae1b5804ba40e5d10a2aa26240bf Mon Sep 17 00:00:00 2001 From: Sunggook Chue Date: Tue, 12 Apr 2022 15:45:42 -0700 Subject: [PATCH] Disallow set_allow_wgc_capturer_fallback call on Win10. There is a crash report from the Windows OS API where it repro only win10, not a Win11. Unfortunately, Microsoft can't access the dump file or hasn't repro internally so we decided to disable the WGC fallback use in the OS other than Win11 now. Once the change (support WGC fallback) reaches to Microsoft Edge and it produce crash report, Edge team will take the dump file to the Windows OS API owner for Win10 level fix (or bring the Win11 fix to Win10). Bug: chromium:1312937 Change-Id: I5335e2c57076d4fab08e9c74ade599259cff10d7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258821 Reviewed-by: Mirko Bonadei Reviewed-by: Alexander Cooper Commit-Queue: Alexander Cooper Cr-Commit-Position: refs/heads/main@{#36558} --- .../desktop_capture/window_capturer_win.cc | 2 +- rtc_base/win/windows_version.cc | 14 ++++++- rtc_base/win/windows_version.h | 39 ++++++++++--------- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/modules/desktop_capture/window_capturer_win.cc b/modules/desktop_capture/window_capturer_win.cc index 7f7bea6eff..f289746e30 100644 --- a/modules/desktop_capture/window_capturer_win.cc +++ b/modules/desktop_capture/window_capturer_win.cc @@ -28,7 +28,7 @@ std::unique_ptr DesktopCapturer::CreateRawWindowCapturer( WindowCapturerWinGdi::CreateRawWindowCapturer(options)); #if defined(RTC_ENABLE_WIN_WGC) if (options.allow_wgc_capturer_fallback() && - rtc::rtc_win::GetVersion() >= rtc::rtc_win::Version::VERSION_WIN10_RS5) { + rtc::rtc_win::GetVersion() >= rtc::rtc_win::Version::VERSION_WIN11) { // BlankDectector capturer will send an error when it detects a failed // GDI rendering, then Fallback capturer will try to capture it again with // WGC. diff --git a/rtc_base/win/windows_version.cc b/rtc_base/win/windows_version.cc index 80e49f2a16..93af1377be 100644 --- a/rtc_base/win/windows_version.cc +++ b/rtc_base/win/windows_version.cc @@ -211,9 +211,21 @@ Version MajorMinorBuildToVersion(int major, int minor, int build) { return VERSION_WIN10_19H1; } else if (build < 19041) { return VERSION_WIN10_19H2; - } else { + } else if (build < 19042) { return VERSION_WIN10_20H1; + } else if (build < 19043) { + return VERSION_WIN10_20H2; + } else if (build < 19044) { + return VERSION_WIN10_21H1; + } else if (build < 20348) { + return VERSION_WIN10_21H2; + } else if (build < 22000) { + return VERSION_SERVER_2022; + } else { + return VERSION_WIN11; } + } else if (major == 11) { + return VERSION_WIN11; } else if (major > 6) { RTC_DCHECK_NOTREACHED(); return VERSION_WIN_LAST; diff --git a/rtc_base/win/windows_version.h b/rtc_base/win/windows_version.h index 3636eabf19..8542626afb 100644 --- a/rtc_base/win/windows_version.h +++ b/rtc_base/win/windows_version.h @@ -30,24 +30,27 @@ namespace rtc_win { enum Version { VERSION_PRE_XP = 0, // Not supported. VERSION_XP = 1, - VERSION_SERVER_2003 = 2, // Also includes XP Pro x64 and Server 2003 R2. - VERSION_VISTA = 3, // Also includes Windows Server 2008. - VERSION_WIN7 = 4, // Also includes Windows Server 2008 R2. - VERSION_WIN8 = 5, // Also includes Windows Server 2012. - VERSION_WIN8_1 = 6, // Also includes Windows Server 2012 R2. - VERSION_WIN10 = 7, // Threshold 1: Version 1507, Build 10240. - VERSION_WIN10_TH2 = 8, // Threshold 2: Version 1511, Build 10586. - VERSION_WIN10_RS1 = 9, // Redstone 1: Version 1607, Build 14393. - VERSION_WIN10_RS2 = 10, // Redstone 2: Version 1703, Build 15063. - VERSION_WIN10_RS3 = 11, // Redstone 3: Version 1709, Build 16299. - 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. + VERSION_SERVER_2003 = 2, // Also includes XP Pro x64 and Server 2003 R2. + VERSION_VISTA = 3, // Also includes Windows Server 2008. + VERSION_WIN7 = 4, // Also includes Windows Server 2008 R2. + VERSION_WIN8 = 5, // Also includes Windows Server 2012. + VERSION_WIN8_1 = 6, // Also includes Windows Server 2012 R2. + VERSION_WIN10 = 7, // Threshold 1: Version 1507, Build 10240. + VERSION_WIN10_TH2 = 8, // Threshold 2: Version 1511, Build 10586. + VERSION_WIN10_RS1 = 9, // Redstone 1: Version 1607, Build 14393. + VERSION_WIN10_RS2 = 10, // Redstone 2: Version 1703, Build 15063. + VERSION_WIN10_RS3 = 11, // Redstone 3: Version 1709, Build 16299. + 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: Version 2004, Build 19041. + VERSION_WIN10_20H2 = 17, // 20H2: Build 19042. + VERSION_WIN10_21H1 = 18, // 21H1: Build 19043. + VERSION_WIN10_21H2 = 19, // 21H2: Build 19044. + VERSION_SERVER_2022 = 20, // Server 2022: Build 20348. + VERSION_WIN11 = 21, // Windows 11: Build 22000. + VERSION_WIN_LAST, // Indicates error condition. }; // A rough bucketing of the available types of versions of Windows. This is used