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 23 matching lines...) Expand all Loading... |
34 void Reset(); | 34 void Reset(); |
35 | 35 |
36 // Resets the counters that are not handled by Reset(). | 36 // Resets the counters that are not handled by Reset(). |
37 void ResetMcu(); | 37 void ResetMcu(); |
38 | 38 |
39 // Resets the waiting time statistics. | 39 // Resets the waiting time statistics. |
40 void ResetWaitingTimeStatistics(); | 40 void ResetWaitingTimeStatistics(); |
41 | 41 |
42 // Reports that |num_samples| samples were produced through expansion, and | 42 // Reports that |num_samples| samples were produced through expansion, and |
43 // that the expansion produced other than just noise samples. | 43 // that the expansion produced other than just noise samples. |
44 void ExpandedVoiceSamples(int num_samples); | 44 void ExpandedVoiceSamples(size_t num_samples); |
45 | 45 |
46 // Reports that |num_samples| samples were produced through expansion, and | 46 // Reports that |num_samples| samples were produced through expansion, and |
47 // that the expansion produced only noise samples. | 47 // that the expansion produced only noise samples. |
48 void ExpandedNoiseSamples(int num_samples); | 48 void ExpandedNoiseSamples(size_t num_samples); |
49 | 49 |
50 // Reports that |num_samples| samples were produced through preemptive | 50 // Reports that |num_samples| samples were produced through preemptive |
51 // expansion. | 51 // expansion. |
52 void PreemptiveExpandedSamples(int num_samples); | 52 void PreemptiveExpandedSamples(size_t num_samples); |
53 | 53 |
54 // Reports that |num_samples| samples were removed through accelerate. | 54 // Reports that |num_samples| samples were removed through accelerate. |
55 void AcceleratedSamples(int num_samples); | 55 void AcceleratedSamples(size_t num_samples); |
56 | 56 |
57 // Reports that |num_samples| zeros were inserted into the output. | 57 // Reports that |num_samples| zeros were inserted into the output. |
58 void AddZeros(int num_samples); | 58 void AddZeros(size_t num_samples); |
59 | 59 |
60 // Reports that |num_packets| packets were discarded. | 60 // Reports that |num_packets| packets were discarded. |
61 void PacketsDiscarded(int num_packets); | 61 void PacketsDiscarded(size_t num_packets); |
62 | 62 |
63 // Reports that |num_samples| were lost. | 63 // Reports that |num_samples| were lost. |
64 void LostSamples(int num_samples); | 64 void LostSamples(size_t num_samples); |
65 | 65 |
66 // Increases the report interval counter with |num_samples| at a sample rate | 66 // Increases the report interval counter with |num_samples| at a sample rate |
67 // of |fs_hz|. | 67 // of |fs_hz|. |
68 void IncreaseCounter(int num_samples, int fs_hz); | 68 void IncreaseCounter(size_t num_samples, int fs_hz); |
69 | 69 |
70 // Stores new packet waiting time in waiting time statistics. | 70 // Stores new packet waiting time in waiting time statistics. |
71 void StoreWaitingTime(int waiting_time_ms); | 71 void StoreWaitingTime(int waiting_time_ms); |
72 | 72 |
73 // Reports that |num_samples| samples were decoded from secondary packets. | 73 // Reports that |num_samples| samples were decoded from secondary packets. |
74 void SecondaryDecodedSamples(int num_samples); | 74 void SecondaryDecodedSamples(int num_samples); |
75 | 75 |
76 // Returns the current network statistics in |stats|. The current sample rate | 76 // Returns the current network statistics in |stats|. The current sample rate |
77 // is |fs_hz|, the total number of samples in packet buffer and sync buffer | 77 // is |fs_hz|, the total number of samples in packet buffer and sync buffer |
78 // yet to play out is |num_samples_in_buffers|, and the number of samples per | 78 // yet to play out is |num_samples_in_buffers|, and the number of samples per |
79 // packet is |samples_per_packet|. | 79 // packet is |samples_per_packet|. |
80 void GetNetworkStatistics(int fs_hz, | 80 void GetNetworkStatistics(int fs_hz, |
81 int num_samples_in_buffers, | 81 size_t num_samples_in_buffers, |
82 int samples_per_packet, | 82 size_t samples_per_packet, |
83 const DelayManager& delay_manager, | 83 const DelayManager& delay_manager, |
84 const DecisionLogic& decision_logic, | 84 const DecisionLogic& decision_logic, |
85 NetEqNetworkStatistics *stats); | 85 NetEqNetworkStatistics *stats); |
86 | 86 |
87 void WaitingTimes(std::vector<int>* waiting_times); | 87 void WaitingTimes(std::vector<int>* waiting_times); |
88 | 88 |
89 private: | 89 private: |
90 static const int kMaxReportPeriod = 60; // Seconds before auto-reset. | 90 static const int kMaxReportPeriod = 60; // Seconds before auto-reset. |
91 static const int kLenWaitingTimes = 100; | 91 static const int kLenWaitingTimes = 100; |
92 | 92 |
93 // Calculates numerator / denominator, and returns the value in Q14. | 93 // Calculates numerator / denominator, and returns the value in Q14. |
94 static uint16_t CalculateQ14Ratio(uint32_t numerator, uint32_t denominator); | 94 static uint16_t CalculateQ14Ratio(size_t numerator, uint32_t denominator); |
95 | 95 |
96 uint32_t preemptive_samples_; | 96 size_t preemptive_samples_; |
97 uint32_t accelerate_samples_; | 97 size_t accelerate_samples_; |
98 int added_zero_samples_; | 98 size_t added_zero_samples_; |
99 uint32_t expanded_speech_samples_; | 99 size_t expanded_speech_samples_; |
100 uint32_t expanded_noise_samples_; | 100 size_t expanded_noise_samples_; |
101 int discarded_packets_; | 101 size_t discarded_packets_; |
102 uint32_t lost_timestamps_; | 102 size_t lost_timestamps_; |
103 uint32_t timestamps_since_last_report_; | 103 uint32_t timestamps_since_last_report_; |
104 int waiting_times_[kLenWaitingTimes]; // Used as a circular buffer. | 104 int waiting_times_[kLenWaitingTimes]; // Used as a circular buffer. |
105 int len_waiting_times_; | 105 int len_waiting_times_; |
106 int next_waiting_time_index_; | 106 int next_waiting_time_index_; |
107 uint32_t secondary_decoded_samples_; | 107 uint32_t secondary_decoded_samples_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(StatisticsCalculator); | 109 DISALLOW_COPY_AND_ASSIGN(StatisticsCalculator); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace webrtc | 112 } // namespace webrtc |
113 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_STATISTICS_CALCULATOR_H_ | 113 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_STATISTICS_CALCULATOR_H_ |
OLD | NEW |