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

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

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync 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
(...skipping 24 matching lines...) Expand all
35 void Reset(); 35 void Reset();
36 36
37 // Resets the counters that are not handled by Reset(). 37 // Resets the counters that are not handled by Reset().
38 void ResetMcu(); 38 void ResetMcu();
39 39
40 // Resets the waiting time statistics. 40 // Resets the waiting time statistics.
41 void ResetWaitingTimeStatistics(); 41 void ResetWaitingTimeStatistics();
42 42
43 // Reports that |num_samples| samples were produced through expansion, and 43 // Reports that |num_samples| samples were produced through expansion, and
44 // that the expansion produced other than just noise samples. 44 // that the expansion produced other than just noise samples.
45 void ExpandedVoiceSamples(int num_samples); 45 void ExpandedVoiceSamples(size_t num_samples);
46 46
47 // Reports that |num_samples| samples were produced through expansion, and 47 // Reports that |num_samples| samples were produced through expansion, and
48 // that the expansion produced only noise samples. 48 // that the expansion produced only noise samples.
49 void ExpandedNoiseSamples(int num_samples); 49 void ExpandedNoiseSamples(size_t num_samples);
50 50
51 // Reports that |num_samples| samples were produced through preemptive 51 // Reports that |num_samples| samples were produced through preemptive
52 // expansion. 52 // expansion.
53 void PreemptiveExpandedSamples(int num_samples); 53 void PreemptiveExpandedSamples(size_t num_samples);
54 54
55 // Reports that |num_samples| samples were removed through accelerate. 55 // Reports that |num_samples| samples were removed through accelerate.
56 void AcceleratedSamples(int num_samples); 56 void AcceleratedSamples(size_t num_samples);
57 57
58 // Reports that |num_samples| zeros were inserted into the output. 58 // Reports that |num_samples| zeros were inserted into the output.
59 void AddZeros(int num_samples); 59 void AddZeros(size_t num_samples);
60 60
61 // Reports that |num_packets| packets were discarded. 61 // Reports that |num_packets| packets were discarded.
62 void PacketsDiscarded(int num_packets); 62 void PacketsDiscarded(size_t num_packets);
63 63
64 // Reports that |num_samples| were lost. 64 // Reports that |num_samples| were lost.
65 void LostSamples(int num_samples); 65 void LostSamples(size_t num_samples);
66 66
67 // Increases the report interval counter with |num_samples| at a sample rate 67 // Increases the report interval counter with |num_samples| at a sample rate
68 // of |fs_hz|. This is how the StatisticsCalculator gets notified that current 68 // of |fs_hz|. This is how the StatisticsCalculator gets notified that current
69 // time is increasing. 69 // time is increasing.
70 void IncreaseCounter(int num_samples, int fs_hz); 70 void IncreaseCounter(size_t num_samples, int fs_hz);
71 71
72 // Stores new packet waiting time in waiting time statistics. 72 // Stores new packet waiting time in waiting time statistics.
73 void StoreWaitingTime(int waiting_time_ms); 73 void StoreWaitingTime(int waiting_time_ms);
74 74
75 // Reports that |num_samples| samples were decoded from secondary packets. 75 // Reports that |num_samples| samples were decoded from secondary packets.
76 void SecondaryDecodedSamples(int num_samples); 76 void SecondaryDecodedSamples(int num_samples);
77 77
78 // Logs a delayed packet outage event of |outage_duration_ms|. A delayed 78 // Logs a delayed packet outage event of |outage_duration_ms|. A delayed
79 // packet outage event is defined as an expand period caused not by an actual 79 // packet outage event is defined as an expand period caused not by an actual
80 // packet loss, but by a delayed packet. 80 // packet loss, but by a delayed packet.
81 virtual void LogDelayedPacketOutageEvent(int outage_duration_ms); 81 virtual void LogDelayedPacketOutageEvent(int outage_duration_ms);
82 82
83 // Returns the current network statistics in |stats|. The current sample rate 83 // Returns the current network statistics in |stats|. The current sample rate
84 // is |fs_hz|, the total number of samples in packet buffer and sync buffer 84 // is |fs_hz|, the total number of samples in packet buffer and sync buffer
85 // yet to play out is |num_samples_in_buffers|, and the number of samples per 85 // yet to play out is |num_samples_in_buffers|, and the number of samples per
86 // packet is |samples_per_packet|. 86 // packet is |samples_per_packet|.
87 void GetNetworkStatistics(int fs_hz, 87 void GetNetworkStatistics(int fs_hz,
88 int num_samples_in_buffers, 88 size_t num_samples_in_buffers,
89 int samples_per_packet, 89 size_t samples_per_packet,
90 const DelayManager& delay_manager, 90 const DelayManager& delay_manager,
91 const DecisionLogic& decision_logic, 91 const DecisionLogic& decision_logic,
92 NetEqNetworkStatistics *stats); 92 NetEqNetworkStatistics *stats);
93 93
94 void WaitingTimes(std::vector<int>* waiting_times); 94 void WaitingTimes(std::vector<int>* waiting_times);
95 95
96 private: 96 private:
97 static const int kMaxReportPeriod = 60; // Seconds before auto-reset. 97 static const int kMaxReportPeriod = 60; // Seconds before auto-reset.
98 static const int kLenWaitingTimes = 100; 98 static const int kLenWaitingTimes = 100;
99 99
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 protected: 143 protected:
144 int Metric() const override; 144 int Metric() const override;
145 void Reset() override; 145 void Reset() override;
146 146
147 private: 147 private:
148 double sum_ = 0.0; 148 double sum_ = 0.0;
149 int counter_ = 0; 149 int counter_ = 0;
150 }; 150 };
151 151
152 // Calculates numerator / denominator, and returns the value in Q14. 152 // Calculates numerator / denominator, and returns the value in Q14.
153 static uint16_t CalculateQ14Ratio(uint32_t numerator, uint32_t denominator); 153 static uint16_t CalculateQ14Ratio(size_t numerator, uint32_t denominator);
154 154
155 uint32_t preemptive_samples_; 155 size_t preemptive_samples_;
156 uint32_t accelerate_samples_; 156 size_t accelerate_samples_;
157 int added_zero_samples_; 157 size_t added_zero_samples_;
158 uint32_t expanded_speech_samples_; 158 size_t expanded_speech_samples_;
159 uint32_t expanded_noise_samples_; 159 size_t expanded_noise_samples_;
160 int discarded_packets_; 160 size_t discarded_packets_;
161 uint32_t lost_timestamps_; 161 size_t lost_timestamps_;
162 uint32_t timestamps_since_last_report_; 162 uint32_t timestamps_since_last_report_;
163 int waiting_times_[kLenWaitingTimes]; // Used as a circular buffer. 163 int waiting_times_[kLenWaitingTimes]; // Used as a circular buffer.
164 int len_waiting_times_; 164 int len_waiting_times_;
165 int next_waiting_time_index_; 165 int next_waiting_time_index_;
166 uint32_t secondary_decoded_samples_; 166 uint32_t secondary_decoded_samples_;
167 PeriodicUmaCount delayed_packet_outage_counter_; 167 PeriodicUmaCount delayed_packet_outage_counter_;
168 PeriodicUmaAverage excess_buffer_delay_; 168 PeriodicUmaAverage excess_buffer_delay_;
169 169
170 DISALLOW_COPY_AND_ASSIGN(StatisticsCalculator); 170 DISALLOW_COPY_AND_ASSIGN(StatisticsCalculator);
171 }; 171 };
172 172
173 } // namespace webrtc 173 } // namespace webrtc
174 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_STATISTICS_CALCULATOR_H_ 174 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_STATISTICS_CALCULATOR_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/random_vector.h ('k') | webrtc/modules/audio_coding/neteq/statistics_calculator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698