desktop_capture_metrics_helper.cc (2091B)
1 /* 2 * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include "modules/desktop_capture/desktop_capture_metrics_helper.h" 12 13 #include <cstdint> 14 15 #include "modules/desktop_capture/desktop_capture_types.h" 16 #include "system_wrappers/include/metrics.h" 17 18 namespace webrtc { 19 namespace { 20 // This enum is logged via UMA so entries should not be reordered or have their 21 // values changed. This should also be kept in sync with the values in the 22 // DesktopCapturerId namespace. 23 enum class SequentialDesktopCapturerId { 24 kUnknown = 0, 25 kWgcCapturerWin = 1, 26 // kScreenCapturerWinMagnifier = 2, 27 kWindowCapturerWinGdi = 3, 28 kScreenCapturerWinGdi = 4, 29 kScreenCapturerWinDirectx = 5, 30 kMaxValue = kScreenCapturerWinDirectx 31 }; 32 } // namespace 33 34 void RecordCapturerImpl(uint32_t capturer_id) { 35 SequentialDesktopCapturerId sequential_id; 36 switch (capturer_id) { 37 case DesktopCapturerId::kWgcCapturerWin: 38 sequential_id = SequentialDesktopCapturerId::kWgcCapturerWin; 39 break; 40 case DesktopCapturerId::kWindowCapturerWinGdi: 41 sequential_id = SequentialDesktopCapturerId::kWindowCapturerWinGdi; 42 break; 43 case DesktopCapturerId::kScreenCapturerWinGdi: 44 sequential_id = SequentialDesktopCapturerId::kScreenCapturerWinGdi; 45 break; 46 case DesktopCapturerId::kScreenCapturerWinDirectx: 47 sequential_id = SequentialDesktopCapturerId::kScreenCapturerWinDirectx; 48 break; 49 case DesktopCapturerId::kUnknown: 50 default: 51 sequential_id = SequentialDesktopCapturerId::kUnknown; 52 } 53 RTC_HISTOGRAM_ENUMERATION( 54 "WebRTC.DesktopCapture.Win.DesktopCapturerImpl", 55 static_cast<int>(sequential_id), 56 static_cast<int>(SequentialDesktopCapturerId::kMaxValue)); 57 } 58 59 } // namespace webrtc