OLD | NEW |
---|---|
(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/render_delay_controller_metrics.h " | |
12 | |
13 #include <algorithm> | |
14 | |
15 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | |
16 #include "webrtc/system_wrappers/include/metrics.h" | |
17 | |
18 namespace webrtc { | |
19 | |
20 RenderDelayControllerMetrics::RenderDelayControllerMetrics() { | |
21 ResetMetrics(); | |
hlundin-webrtc
2017/02/28 10:04:23
No need.
peah-webrtc
2017/02/28 12:57:26
Done.
| |
22 } | |
23 | |
24 void RenderDelayControllerMetrics::ResetMetrics() { | |
hlundin-webrtc
2017/02/28 10:04:23
Wrong order of methods.
peah-webrtc
2017/02/28 12:57:26
Done.
| |
25 delay_change_counter_ = 0; | |
26 reliable_delay_estimate_counter_ = 0; | |
27 } | |
28 | |
29 void RenderDelayControllerMetrics::Update(rtc::Optional<size_t> delay_samples, | |
30 size_t buffer_delay_blocks) { | |
31 ++call_counter_; | |
32 | |
33 if (!initial_update) { | |
34 if (delay_samples) { | |
35 ++reliable_delay_estimate_counter_; | |
36 size_t delay_blocks = (*delay_samples) / kBlockSize; | |
37 | |
38 if (delay_blocks != delay_blocks_) { | |
39 ++delay_change_counter_; | |
40 delay_blocks_ = delay_blocks; | |
41 } | |
42 } | |
43 } else if (++initial_call_counter_ == 5 * 250) { | |
44 initial_update = false; | |
45 } | |
46 | |
47 if (call_counter_ == kMetricsReportingInterval) { | |
48 int value_to_report = static_cast<int>(delay_blocks_); | |
49 value_to_report = std::min(124, value_to_report); | |
50 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.EchoCanceller.EchoPathDelay", | |
51 value_to_report, 0, 124, 125); | |
52 | |
53 value_to_report = static_cast<int>(buffer_delay_blocks); | |
54 value_to_report = std::min(124, value_to_report); | |
55 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.EchoCanceller.BufferDelay", | |
56 value_to_report, 0, 124, 125); | |
57 | |
58 if (reliable_delay_estimate_counter_ == 0) { | |
59 value_to_report = 0; | |
hlundin-webrtc
2017/02/28 10:04:23
Again, some kind of enum?
peah-webrtc
2017/02/28 12:57:26
Done.
| |
60 } else if (reliable_delay_estimate_counter_ > (call_counter_ >> 1)) { | |
61 value_to_report = 4; | |
62 } else if (reliable_delay_estimate_counter_ > 100) { | |
63 value_to_report = 3; | |
64 } else if (reliable_delay_estimate_counter_ > 10) { | |
65 value_to_report = 2; | |
66 } else { | |
67 value_to_report = 1; | |
68 } | |
69 RTC_HISTOGRAM_COUNTS_LINEAR( | |
hlundin-webrtc
2017/02/28 10:04:23
RTC_HISTOGRAM_ENUMERATION
peah-webrtc
2017/02/28 12:57:26
Done.
| |
70 "WebRTC.Audio.EchoCanceller.ReliableDelayEstimates", value_to_report, 0, | |
71 4, 5); | |
72 | |
73 if (delay_change_counter_ == 0) { | |
74 value_to_report = 0; | |
75 } else if (delay_change_counter_ > 10) { | |
76 value_to_report = 4; | |
77 } else if (delay_change_counter_ > 5) { | |
78 value_to_report = 3; | |
79 } else if (delay_change_counter_ > 2) { | |
80 value_to_report = 2; | |
81 } else { | |
82 value_to_report = 1; | |
83 } | |
84 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.EchoCanceller.DelayChanges", | |
hlundin-webrtc
2017/02/28 10:04:23
RTC_HISTOGRAM_ENUMERATION
peah-webrtc
2017/02/28 12:57:26
Done.
| |
85 value_to_report, 0, 4, 5); | |
86 | |
87 metric_reported_ = true; | |
88 call_counter_ = 0; | |
89 } else { | |
90 metric_reported_ = false; | |
91 } | |
92 } | |
93 | |
94 } // namespace webrtc | |
OLD | NEW |