Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: webrtc/modules/audio_processing/aec3/block_processor_metrics.cc

Issue 2722453002: Adding metrics to AEC3 (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 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 "webrtc/modules/audio_processing/aec3/block_processor_metrics.h"
12
13 #include "webrtc/modules/audio_processing/aec3/aec3_common.h"
14 #include "webrtc/system_wrappers/include/metrics.h"
15
16 namespace webrtc {
17
18 BlockProcessorMetrics::BlockProcessorMetrics() {
19 ResetMetrics();
hlundin-webrtc 2017/02/28 10:04:22 No need to call reset here, since nothing changes
peah-webrtc 2017/02/28 12:57:25 Done.
20 }
21
22 void BlockProcessorMetrics::ResetMetrics() {
hlundin-webrtc 2017/02/28 10:04:22 Wrong order of methods compared to h file.
peah-webrtc 2017/02/28 12:57:25 Done.
23 render_buffer_underruns_ = 0;
24 render_buffer_overruns_ = 0;
25 buffer_render_calls_ = 0;
26 }
27
28 void BlockProcessorMetrics::UpdateCapture(bool underrun) {
29 ++capture_block_counter_;
30 if (underrun) {
31 ++render_buffer_underruns_;
32 }
33
34 if (capture_block_counter_ == kMetricsReportingInterval) {
35 metric_reported_ = true;
36
37 int value_to_report;
38 if (render_buffer_underruns_ == 0) {
39 value_to_report = 0;
hlundin-webrtc 2017/02/28 10:04:22 Is this some kind of enum metric? If so, I suggest
peah-webrtc 2017/02/28 12:57:25 Done.
40 } else if (render_buffer_underruns_ > (capture_block_counter_ >> 1)) {
41 value_to_report = 4;
42 } else if (render_buffer_underruns_ > 100) {
43 value_to_report = 3;
44 } else if (render_buffer_underruns_ > 10) {
45 value_to_report = 2;
46 } else {
47 value_to_report = 1;
48 }
49 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.EchoCanceller.RenderUnderruns",
50 value_to_report, 0, 4, 5);
51
52 if (render_buffer_overruns_ == 0) {
53 value_to_report = 0;
54 } else if (render_buffer_overruns_ > (buffer_render_calls_ >> 1)) {
55 value_to_report = 4;
56 } else if (render_buffer_overruns_ > 100) {
57 value_to_report = 3;
58 } else if (render_buffer_overruns_ > 10) {
59 value_to_report = 2;
60 } else {
61 value_to_report = 1;
62 }
63 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.EchoCanceller.RenderOverruns",
64 value_to_report, 0, 4, 5);
65
66 capture_block_counter_ = 0;
hlundin-webrtc 2017/02/28 10:04:22 Shouldn't buffer_render_calls_ be reset too?
peah-webrtc 2017/02/28 12:57:25 Good find! The call to ResetMetrics() was missing.
67 } else {
68 metric_reported_ = false;
69 }
70 }
71
72 void BlockProcessorMetrics::UpdateRender(bool overrun) {
73 ++buffer_render_calls_;
74 if (overrun) {
75 ++render_buffer_overruns_;
76 }
77 }
78
79 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698