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

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

Issue 1292423003: NetEq: Implement counting of Delayed Packet Outage Events per minute (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-metrics
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/statistics_calculator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/statistics_calculator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698