Bug 1924098 - Vendor libwebrtc from dfd8f570cd

Upstream commit: https://webrtc.googlesource.com/src/+/dfd8f570cd069d502c2ea923256ef835971e97b5
    Adds a WebRTC.DesktopCapture.Win.WgcDirtyRegionSupport UMA for diagnostic purposes.

    Checks if the DirtyRegionMode property is present in GraphicsCaptureSession and logs a boolean histogram with the result.
    Detecting support for this property means that the WGC API supports
    dirty regions and it can be utilized to improve the capture
    performance and the existing zero-herz support.

    See also https://issues.chromium.org/issues/347991512 for more details
    on how to detect support for dirty regions in WGC.

    Bug: chromium:40259177
    Change-Id: Ia316c4ece54bd93cfef1fa23c199675c64143f76
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362240
    Reviewed-by: Alexander Cooper <alcooper@chromium.org>
    Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#43015}
This commit is contained in:
Michael Froman 2024-10-15 19:05:21 -05:00
parent 236daa3298
commit fc6ec53b9c
3 changed files with 46 additions and 1 deletions

View File

@ -32832,3 +32832,6 @@ fb0da3a2aa
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
97c594fafe
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
dfd8f570cd

View File

@ -21912,3 +21912,5 @@ libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-10-16T00:03:21.404528.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-10-16T00:04:17.235239.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-10-16T00:05:11.582070.

View File

@ -38,6 +38,7 @@ constexpr wchar_t kCoreMessagingDll[] = L"CoreMessaging.dll";
constexpr wchar_t kWgcSessionType[] =
L"Windows.Graphics.Capture.GraphicsCaptureSession";
constexpr wchar_t kApiContract[] = L"Windows.Foundation.UniversalApiContract";
constexpr wchar_t kDirtyRegionMode[] = L"DirtyRegionMode";
constexpr UINT16 kRequiredApiContractVersion = 8;
enum class WgcCapturerResult {
@ -58,6 +59,44 @@ void RecordWgcCapturerResult(WgcCapturerResult error) {
static_cast<int>(WgcCapturerResult::kMaxValue));
}
// Checks if the DirtyRegionMode property is present in GraphicsCaptureSession
// and logs a boolean histogram with the result.
// TODO(https://crbug.com/40259177): Detecting support for this property means
// that the WGC API supports dirty regions and it can be utilized to improve
// the capture performance and the existing zero-herz support.
void LogDirtyRegionSupport() {
ComPtr<ABI::Windows::Foundation::Metadata::IApiInformationStatics>
api_info_statics;
HRESULT hr = GetActivationFactory<
ABI::Windows::Foundation::Metadata::IApiInformationStatics,
RuntimeClass_Windows_Foundation_Metadata_ApiInformation>(
&api_info_statics);
if (FAILED(hr)) {
return;
}
HSTRING dirty_region_mode;
hr = webrtc::CreateHstring(kDirtyRegionMode, wcslen(kDirtyRegionMode),
&dirty_region_mode);
if (FAILED(hr)) {
webrtc::DeleteHstring(dirty_region_mode);
return;
}
HSTRING wgc_session_type;
hr = webrtc::CreateHstring(kWgcSessionType, wcslen(kWgcSessionType),
&wgc_session_type);
if (SUCCEEDED(hr)) {
boolean is_dirty_region_mode_supported =
api_info_statics->IsPropertyPresent(wgc_session_type, dirty_region_mode,
&is_dirty_region_mode_supported);
RTC_HISTOGRAM_BOOLEAN("WebRTC.DesktopCapture.Win.WgcDirtyRegionSupport",
!!is_dirty_region_mode_supported);
}
webrtc::DeleteHstring(dirty_region_mode);
webrtc::DeleteHstring(wgc_session_type);
}
} // namespace
bool IsWgcSupported(CaptureType capture_type) {
@ -87,7 +126,7 @@ bool IsWgcSupported(CaptureType capture_type) {
if (!ResolveCoreWinRTDelayload())
return false;
// We need to check if the WGC APIs are presesnt on the system. Certain SKUs
// We need to check if the WGC APIs are present on the system. Certain SKUs
// of Windows ship without these APIs.
ComPtr<ABI::Windows::Foundation::Metadata::IApiInformationStatics>
api_info_statics;
@ -156,6 +195,7 @@ WgcCapturerWin::WgcCapturerWin(
reinterpret_cast<CreateDispatcherQueueControllerFunc>(GetProcAddress(
core_messaging_library_, "CreateDispatcherQueueController"));
}
LogDirtyRegionSupport();
}
WgcCapturerWin::~WgcCapturerWin() {