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

Side by Side Diff: webrtc/modules/audio_coding/neteq/statistics_calculator.cc

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 years, 3 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
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 #include <algorithm> 15 #include <algorithm>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/safe_conversions.h" 18 #include "webrtc/base/safe_conversions.h"
19 #include "webrtc/modules/audio_coding/neteq/decision_logic.h" 19 #include "webrtc/modules/audio_coding/neteq/decision_logic.h"
20 #include "webrtc/modules/audio_coding/neteq/delay_manager.h" 20 #include "webrtc/modules/audio_coding/neteq/delay_manager.h"
21 #include "webrtc/system_wrappers/interface/metrics.h" 21 #include "webrtc/system_wrappers/interface/metrics.h"
22 22
23 namespace webrtc { 23 namespace webrtc {
24 24
25 // Allocating the static const so that it can be passed by reference to DCHECK. 25 // Allocating the static const so that it can be passed by reference to
26 // RTC_DCHECK.
26 const size_t StatisticsCalculator::kLenWaitingTimes; 27 const size_t StatisticsCalculator::kLenWaitingTimes;
27 28
28 StatisticsCalculator::PeriodicUmaLogger::PeriodicUmaLogger( 29 StatisticsCalculator::PeriodicUmaLogger::PeriodicUmaLogger(
29 const std::string& uma_name, 30 const std::string& uma_name,
30 int report_interval_ms, 31 int report_interval_ms,
31 int max_value) 32 int max_value)
32 : uma_name_(uma_name), 33 : uma_name_(uma_name),
33 report_interval_ms_(report_interval_ms), 34 report_interval_ms_(report_interval_ms),
34 max_value_(max_value), 35 max_value_(max_value),
35 timer_(0) { 36 timer_(0) {
36 } 37 }
37 38
38 StatisticsCalculator::PeriodicUmaLogger::~PeriodicUmaLogger() = default; 39 StatisticsCalculator::PeriodicUmaLogger::~PeriodicUmaLogger() = default;
39 40
40 void StatisticsCalculator::PeriodicUmaLogger::AdvanceClock(int step_ms) { 41 void StatisticsCalculator::PeriodicUmaLogger::AdvanceClock(int step_ms) {
41 timer_ += step_ms; 42 timer_ += step_ms;
42 if (timer_ < report_interval_ms_) { 43 if (timer_ < report_interval_ms_) {
43 return; 44 return;
44 } 45 }
45 LogToUma(Metric()); 46 LogToUma(Metric());
46 Reset(); 47 Reset();
47 timer_ -= report_interval_ms_; 48 timer_ -= report_interval_ms_;
48 DCHECK_GE(timer_, 0); 49 RTC_DCHECK_GE(timer_, 0);
49 } 50 }
50 51
51 void StatisticsCalculator::PeriodicUmaLogger::LogToUma(int value) const { 52 void StatisticsCalculator::PeriodicUmaLogger::LogToUma(int value) const {
52 RTC_HISTOGRAM_COUNTS(uma_name_, value, 1, max_value_, 50); 53 RTC_HISTOGRAM_COUNTS(uma_name_, value, 1, max_value_, 50);
53 } 54 }
54 55
55 StatisticsCalculator::PeriodicUmaCount::PeriodicUmaCount( 56 StatisticsCalculator::PeriodicUmaCount::PeriodicUmaCount(
56 const std::string& uma_name, 57 const std::string& uma_name,
57 int report_interval_ms, 58 int report_interval_ms,
58 int max_value) 59 int max_value)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 188
188 void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) { 189 void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) {
189 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.DelayedPacketOutageEventMs", 190 RTC_HISTOGRAM_COUNTS("WebRTC.Audio.DelayedPacketOutageEventMs",
190 outage_duration_ms, 1 /* min */, 2000 /* max */, 191 outage_duration_ms, 1 /* min */, 2000 /* max */,
191 100 /* bucket count */); 192 100 /* bucket count */);
192 delayed_packet_outage_counter_.RegisterSample(); 193 delayed_packet_outage_counter_.RegisterSample();
193 } 194 }
194 195
195 void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) { 196 void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) {
196 excess_buffer_delay_.RegisterSample(waiting_time_ms); 197 excess_buffer_delay_.RegisterSample(waiting_time_ms);
197 DCHECK_LE(waiting_times_.size(), kLenWaitingTimes); 198 RTC_DCHECK_LE(waiting_times_.size(), kLenWaitingTimes);
198 if (waiting_times_.size() == kLenWaitingTimes) { 199 if (waiting_times_.size() == kLenWaitingTimes) {
199 // Erase first value. 200 // Erase first value.
200 waiting_times_.pop_front(); 201 waiting_times_.pop_front();
201 } 202 }
202 waiting_times_.push_back(waiting_time_ms); 203 waiting_times_.push_back(waiting_time_ms);
203 } 204 }
204 205
205 void StatisticsCalculator::GetNetworkStatistics( 206 void StatisticsCalculator::GetNetworkStatistics(
206 int fs_hz, 207 int fs_hz,
207 size_t num_samples_in_buffers, 208 size_t num_samples_in_buffers,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // Ratio must be smaller than 1 in Q14. 287 // Ratio must be smaller than 1 in Q14.
287 assert((numerator << 14) / denominator < (1 << 14)); 288 assert((numerator << 14) / denominator < (1 << 14));
288 return static_cast<uint16_t>((numerator << 14) / denominator); 289 return static_cast<uint16_t>((numerator << 14) / denominator);
289 } else { 290 } else {
290 // 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.
291 return 1 << 14; 292 return 1 << 14;
292 } 293 }
293 } 294 }
294 295
295 } // namespace webrtc 296 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl.cc ('k') | webrtc/modules/audio_coding/neteq/time_stretch_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698