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:
parent
97c594fafe
commit
dfd8f570cd
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user