As part of adding the new WgcCapturerWin implementation of the DesktopCapturer interface, we should ensure that we can measure the health and success of this new code. In order to quantify that, I've added telemetry to measure the usage of each capturer implementation, the time taken to capture a frame, and any errors that are encountered in the new implementation. I've also set the capturer id property of frames so that we can measure error rates and performance of each implementation in Chromium as well. This CL must be completed after this Chromium CL lands: 2806094: Add histograms to record new WebRTC DesktopCapturer telemetry | https://chromium-review.googlesource.com/c/chromium/src/+/2806094 Bug: webrtc:9273 Change-Id: I33b0a008568a4df4f95e705271badc3313872f17 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214060 Commit-Queue: Austin Orion <auorion@microsoft.com> Reviewed-by: Jamie Walch <jamiewalch@chromium.org> Cr-Commit-Position: refs/heads/master@{#33716}
61 lines
2.2 KiB
C++
61 lines
2.2 KiB
C++
/*
|
|
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "modules/desktop_capture/desktop_capture_metrics_helper.h"
|
|
|
|
#include "modules/desktop_capture/desktop_capture_types.h"
|
|
#include "system_wrappers/include/metrics.h"
|
|
|
|
namespace webrtc {
|
|
namespace {
|
|
// This enum is logged via UMA so entries should not be reordered or have their
|
|
// values changed. This should also be kept in sync with the values in the
|
|
// DesktopCapturerId namespace.
|
|
enum class SequentialDesktopCapturerId {
|
|
kUnknown = 0,
|
|
kWgcCapturerWin = 1,
|
|
kScreenCapturerWinMagnifier = 2,
|
|
kWindowCapturerWinGdi = 3,
|
|
kScreenCapturerWinGdi = 4,
|
|
kScreenCapturerWinDirectx = 5,
|
|
kMaxValue = kScreenCapturerWinDirectx
|
|
};
|
|
} // namespace
|
|
|
|
void RecordCapturerImpl(uint32_t capturer_id) {
|
|
SequentialDesktopCapturerId sequential_id;
|
|
switch (capturer_id) {
|
|
case DesktopCapturerId::kWgcCapturerWin:
|
|
sequential_id = SequentialDesktopCapturerId::kWgcCapturerWin;
|
|
break;
|
|
case DesktopCapturerId::kScreenCapturerWinMagnifier:
|
|
sequential_id = SequentialDesktopCapturerId::kScreenCapturerWinMagnifier;
|
|
break;
|
|
case DesktopCapturerId::kWindowCapturerWinGdi:
|
|
sequential_id = SequentialDesktopCapturerId::kWindowCapturerWinGdi;
|
|
break;
|
|
case DesktopCapturerId::kScreenCapturerWinGdi:
|
|
sequential_id = SequentialDesktopCapturerId::kScreenCapturerWinGdi;
|
|
break;
|
|
case DesktopCapturerId::kScreenCapturerWinDirectx:
|
|
sequential_id = SequentialDesktopCapturerId::kScreenCapturerWinDirectx;
|
|
break;
|
|
case DesktopCapturerId::kUnknown:
|
|
default:
|
|
sequential_id = SequentialDesktopCapturerId::kUnknown;
|
|
}
|
|
RTC_HISTOGRAM_ENUMERATION(
|
|
"WebRTC.DesktopCapture.Win.DesktopCapturerImpl",
|
|
static_cast<int>(sequential_id),
|
|
static_cast<int>(SequentialDesktopCapturerId::kMaxValue));
|
|
}
|
|
|
|
} // namespace webrtc
|