| 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 if (timer_ < report_interval_ms_) { | 43 if (timer_ < report_interval_ms_) { |
| 44 return; | 44 return; |
| 45 } | 45 } |
| 46 LogToUma(Metric()); | 46 LogToUma(Metric()); |
| 47 Reset(); | 47 Reset(); |
| 48 timer_ -= report_interval_ms_; | 48 timer_ -= report_interval_ms_; |
| 49 RTC_DCHECK_GE(timer_, 0); | 49 RTC_DCHECK_GE(timer_, 0); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void StatisticsCalculator::PeriodicUmaLogger::LogToUma(int value) const { | 52 void StatisticsCalculator::PeriodicUmaLogger::LogToUma(int value) const { |
| 53 RTC_HISTOGRAM_COUNTS(uma_name_, value, 1, max_value_, 50); | 53 RTC_HISTOGRAM_COUNTS_SPARSE(uma_name_, value, 1, max_value_, 50); |
| 54 } | 54 } |
| 55 | 55 |
| 56 StatisticsCalculator::PeriodicUmaCount::PeriodicUmaCount( | 56 StatisticsCalculator::PeriodicUmaCount::PeriodicUmaCount( |
| 57 const std::string& uma_name, | 57 const std::string& uma_name, |
| 58 int report_interval_ms, | 58 int report_interval_ms, |
| 59 int max_value) | 59 int max_value) |
| 60 : PeriodicUmaLogger(uma_name, report_interval_ms, max_value) { | 60 : PeriodicUmaLogger(uma_name, report_interval_ms, max_value) { |
| 61 } | 61 } |
| 62 | 62 |
| 63 StatisticsCalculator::PeriodicUmaCount::~PeriodicUmaCount() { | 63 StatisticsCalculator::PeriodicUmaCount::~PeriodicUmaCount() { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 timestamps_since_last_report_ = 0; | 180 timestamps_since_last_report_ = 0; |
| 181 discarded_packets_ = 0; | 181 discarded_packets_ = 0; |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 void StatisticsCalculator::SecondaryDecodedSamples(int num_samples) { | 185 void StatisticsCalculator::SecondaryDecodedSamples(int num_samples) { |
| 186 secondary_decoded_samples_ += num_samples; | 186 secondary_decoded_samples_ += num_samples; |
| 187 } | 187 } |
| 188 | 188 |
| 189 void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) { | 189 void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) { |
| 190 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.DelayedPacketOutageEventMs", | 190 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.Audio.DelayedPacketOutageEventMs", |
| 191 outage_duration_ms, 1 /* min */, 2000 /* max */, | 191 outage_duration_ms, 1 /* min */, 2000 /* max */, |
| 192 100 /* bucket count */); | 192 100 /* bucket count */); |
| 193 delayed_packet_outage_counter_.RegisterSample(); | 193 delayed_packet_outage_counter_.RegisterSample(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) { | 196 void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) { |
| 197 excess_buffer_delay_.RegisterSample(waiting_time_ms); | 197 excess_buffer_delay_.RegisterSample(waiting_time_ms); |
| 198 RTC_DCHECK_LE(waiting_times_.size(), kLenWaitingTimes); | 198 RTC_DCHECK_LE(waiting_times_.size(), kLenWaitingTimes); |
| 199 if (waiting_times_.size() == kLenWaitingTimes) { | 199 if (waiting_times_.size() == kLenWaitingTimes) { |
| 200 // Erase first value. | 200 // Erase first value. |
| 201 waiting_times_.pop_front(); | 201 waiting_times_.pop_front(); |
| 202 } | 202 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // Ratio must be smaller than 1 in Q14. | 287 // Ratio must be smaller than 1 in Q14. |
| 288 assert((numerator << 14) / denominator < (1 << 14)); | 288 assert((numerator << 14) / denominator < (1 << 14)); |
| 289 return static_cast<uint16_t>((numerator << 14) / denominator); | 289 return static_cast<uint16_t>((numerator << 14) / denominator); |
| 290 } else { | 290 } else { |
| 291 // Will not produce a ratio larger than 1, since this is probably an error. | 291 // Will not produce a ratio larger than 1, since this is probably an error. |
| 292 return 1 << 14; | 292 return 1 << 14; |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace webrtc | 296 } // namespace webrtc |
| OLD | NEW |