OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/audio_coding/neteq/statistics_calculator.h" | 11 #include "webrtc/modules/audio_coding/neteq/statistics_calculator.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <string.h> // memset | 14 #include <string.h> // memset |
15 | 15 |
16 #include "webrtc/modules/audio_coding/neteq/decision_logic.h" | 16 #include "webrtc/modules/audio_coding/neteq/decision_logic.h" |
17 #include "webrtc/modules/audio_coding/neteq/delay_manager.h" | 17 #include "webrtc/modules/audio_coding/neteq/delay_manager.h" |
| 18 #include "webrtc/system_wrappers/interface/metrics.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 | 21 |
21 StatisticsCalculator::StatisticsCalculator() | 22 StatisticsCalculator::StatisticsCalculator() |
22 : preemptive_samples_(0), | 23 : preemptive_samples_(0), |
23 accelerate_samples_(0), | 24 accelerate_samples_(0), |
24 added_zero_samples_(0), | 25 added_zero_samples_(0), |
25 expanded_speech_samples_(0), | 26 expanded_speech_samples_(0), |
26 expanded_noise_samples_(0), | 27 expanded_noise_samples_(0), |
27 discarded_packets_(0), | 28 discarded_packets_(0), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 lost_timestamps_ = 0; | 90 lost_timestamps_ = 0; |
90 timestamps_since_last_report_ = 0; | 91 timestamps_since_last_report_ = 0; |
91 discarded_packets_ = 0; | 92 discarded_packets_ = 0; |
92 } | 93 } |
93 } | 94 } |
94 | 95 |
95 void StatisticsCalculator::SecondaryDecodedSamples(int num_samples) { | 96 void StatisticsCalculator::SecondaryDecodedSamples(int num_samples) { |
96 secondary_decoded_samples_ += num_samples; | 97 secondary_decoded_samples_ += num_samples; |
97 } | 98 } |
98 | 99 |
| 100 void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) { |
| 101 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.DelayedPacketOutageEventMs", |
| 102 outage_duration_ms, 1 /* min */, 2000 /* max */, |
| 103 100 /* bucket count */); |
| 104 } |
| 105 |
99 void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) { | 106 void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) { |
100 assert(next_waiting_time_index_ < kLenWaitingTimes); | 107 assert(next_waiting_time_index_ < kLenWaitingTimes); |
101 waiting_times_[next_waiting_time_index_] = waiting_time_ms; | 108 waiting_times_[next_waiting_time_index_] = waiting_time_ms; |
102 next_waiting_time_index_++; | 109 next_waiting_time_index_++; |
103 if (next_waiting_time_index_ >= kLenWaitingTimes) { | 110 if (next_waiting_time_index_ >= kLenWaitingTimes) { |
104 next_waiting_time_index_ = 0; | 111 next_waiting_time_index_ = 0; |
105 } | 112 } |
106 if (len_waiting_times_ < kLenWaitingTimes) { | 113 if (len_waiting_times_ < kLenWaitingTimes) { |
107 len_waiting_times_++; | 114 len_waiting_times_++; |
108 } | 115 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Ratio must be smaller than 1 in Q14. | 183 // Ratio must be smaller than 1 in Q14. |
177 assert((numerator << 14) / denominator < (1 << 14)); | 184 assert((numerator << 14) / denominator < (1 << 14)); |
178 return static_cast<uint16_t>((numerator << 14) / denominator); | 185 return static_cast<uint16_t>((numerator << 14) / denominator); |
179 } else { | 186 } else { |
180 // Will not produce a ratio larger than 1, since this is probably an error. | 187 // Will not produce a ratio larger than 1, since this is probably an error. |
181 return 1 << 14; | 188 return 1 << 14; |
182 } | 189 } |
183 } | 190 } |
184 | 191 |
185 } // namespace webrtc | 192 } // namespace webrtc |
OLD | NEW |