From b0e1cb254e9e21b04391aa49a4d74f89658a618a Mon Sep 17 00:00:00 2001 From: henrika Date: Sat, 4 Feb 2023 11:27:23 +0100 Subject: [PATCH] Adds WebRTC.DesktopCapture.Win.DirectXCapturerResult UMA This records high level errors, or success, encountered across the entire capture flow in the DXGI based capturer. Using the same style as for WebRTC.DesktopCapture.Win.WgcCapturerResult Bug: chromium:1400204 Change-Id: I7096d1790d7c2a23bbe29761b7dbf40426ce1e6a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291707 Reviewed-by: Alexander Cooper Commit-Queue: Henrik Andreassson Cr-Commit-Position: refs/heads/main@{#39259} --- .../win/dxgi_duplicator_controller.h | 16 ++++++++++------ .../win/screen_capturer_win_directx.cc | 4 ++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/desktop_capture/win/dxgi_duplicator_controller.h b/modules/desktop_capture/win/dxgi_duplicator_controller.h index 88c2939187..97ed2d8b0d 100644 --- a/modules/desktop_capture/win/dxgi_duplicator_controller.h +++ b/modules/desktop_capture/win/dxgi_duplicator_controller.h @@ -64,13 +64,17 @@ class RTC_EXPORT DxgiDuplicatorController { // version. }; + // These values are persisted to logs. Entries should not be renumbered or + // reordered and numeric values should never be reused. This enum corresponds + // to WebRtcDirectXCapturerResult in tools/metrics/histograms/enums.xml. enum class Result { - SUCCEEDED, - UNSUPPORTED_SESSION, - FRAME_PREPARE_FAILED, - INITIALIZATION_FAILED, - DUPLICATION_FAILED, - INVALID_MONITOR_ID, + SUCCEEDED = 0, + UNSUPPORTED_SESSION = 1, + FRAME_PREPARE_FAILED = 2, + INITIALIZATION_FAILED = 3, + DUPLICATION_FAILED = 4, + INVALID_MONITOR_ID = 5, + MAX_VALUE = INVALID_MONITOR_ID }; // Converts `result` into user-friendly string representation. The return diff --git a/modules/desktop_capture/win/screen_capturer_win_directx.cc b/modules/desktop_capture/win/screen_capturer_win_directx.cc index efa763993a..3aaac03057 100644 --- a/modules/desktop_capture/win/screen_capturer_win_directx.cc +++ b/modules/desktop_capture/win/screen_capturer_win_directx.cc @@ -151,6 +151,10 @@ void ScreenCapturerWinDirectx::CaptureFrame() { "error code " << DxgiDuplicatorController::ResultName(result); } + RTC_HISTOGRAM_ENUMERATION( + "WebRTC.DesktopCapture.Win.DirectXCapturerResult", + static_cast(result), + static_cast(DxgiDuplicatorController::Result::MAX_VALUE)); switch (result) { case DuplicateResult::UNSUPPORTED_SESSION: { RTC_LOG(LS_ERROR)