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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(int 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(int 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(int 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|. This is how the StatisticsCalculator gets notified that current |
| 68 // time is increasing. |
68 void IncreaseCounter(int num_samples, int fs_hz); | 69 void IncreaseCounter(int num_samples, int fs_hz); |
69 | 70 |
70 // Stores new packet waiting time in waiting time statistics. | 71 // Stores new packet waiting time in waiting time statistics. |
71 void StoreWaitingTime(int waiting_time_ms); | 72 void StoreWaitingTime(int waiting_time_ms); |
72 | 73 |
73 // Reports that |num_samples| samples were decoded from secondary packets. | 74 // Reports that |num_samples| samples were decoded from secondary packets. |
74 void SecondaryDecodedSamples(int num_samples); | 75 void SecondaryDecodedSamples(int num_samples); |
75 | 76 |
76 // Logs a delayed packet outage event of |outage_duration_ms|. A delayed | 77 // Logs a delayed packet outage event of |outage_duration_ms|. A delayed |
77 // packet outage event is defined as an expand period caused not by an actual | 78 // packet outage event is defined as an expand period caused not by an actual |
(...skipping 10 matching lines...) Expand all Loading... |
88 const DelayManager& delay_manager, | 89 const DelayManager& delay_manager, |
89 const DecisionLogic& decision_logic, | 90 const DecisionLogic& decision_logic, |
90 NetEqNetworkStatistics *stats); | 91 NetEqNetworkStatistics *stats); |
91 | 92 |
92 void WaitingTimes(std::vector<int>* waiting_times); | 93 void WaitingTimes(std::vector<int>* waiting_times); |
93 | 94 |
94 private: | 95 private: |
95 static const int kMaxReportPeriod = 60; // Seconds before auto-reset. | 96 static const int kMaxReportPeriod = 60; // Seconds before auto-reset. |
96 static const int kLenWaitingTimes = 100; | 97 static const int kLenWaitingTimes = 100; |
97 | 98 |
| 99 class DelayedPacketOutagesPerMinuteCounter { |
| 100 public: |
| 101 ~DelayedPacketOutagesPerMinuteCounter() { |
| 102 LogToUma(); // Log the count for the current (incomplete) interval. |
| 103 } |
| 104 void RegisterEvent(); |
| 105 void AdvanceClock(int step_ms); |
| 106 |
| 107 private: |
| 108 static const int kReportIntervalMs = 60 * 1000; // One minute. |
| 109 |
| 110 void LogToUma() const; |
| 111 |
| 112 int counter_ = 0; |
| 113 int timer_ = 0; |
| 114 }; |
| 115 |
98 // Calculates numerator / denominator, and returns the value in Q14. | 116 // Calculates numerator / denominator, and returns the value in Q14. |
99 static uint16_t CalculateQ14Ratio(uint32_t numerator, uint32_t denominator); | 117 static uint16_t CalculateQ14Ratio(uint32_t numerator, uint32_t denominator); |
100 | 118 |
101 uint32_t preemptive_samples_; | 119 uint32_t preemptive_samples_; |
102 uint32_t accelerate_samples_; | 120 uint32_t accelerate_samples_; |
103 int added_zero_samples_; | 121 int added_zero_samples_; |
104 uint32_t expanded_speech_samples_; | 122 uint32_t expanded_speech_samples_; |
105 uint32_t expanded_noise_samples_; | 123 uint32_t expanded_noise_samples_; |
106 int discarded_packets_; | 124 int discarded_packets_; |
107 uint32_t lost_timestamps_; | 125 uint32_t lost_timestamps_; |
108 uint32_t timestamps_since_last_report_; | 126 uint32_t timestamps_since_last_report_; |
109 int waiting_times_[kLenWaitingTimes]; // Used as a circular buffer. | 127 int waiting_times_[kLenWaitingTimes]; // Used as a circular buffer. |
110 int len_waiting_times_; | 128 int len_waiting_times_; |
111 int next_waiting_time_index_; | 129 int next_waiting_time_index_; |
112 uint32_t secondary_decoded_samples_; | 130 uint32_t secondary_decoded_samples_; |
| 131 DelayedPacketOutagesPerMinuteCounter delayed_packet_outage_counter_; |
113 | 132 |
114 DISALLOW_COPY_AND_ASSIGN(StatisticsCalculator); | 133 DISALLOW_COPY_AND_ASSIGN(StatisticsCalculator); |
115 }; | 134 }; |
116 | 135 |
117 } // namespace webrtc | 136 } // namespace webrtc |
118 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_STATISTICS_CALCULATOR_H_ | 137 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_STATISTICS_CALCULATOR_H_ |
OLD | NEW |