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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 216 } |
217 | 217 |
218 stats->added_zero_samples = added_zero_samples_; | 218 stats->added_zero_samples = added_zero_samples_; |
219 stats->current_buffer_size_ms = | 219 stats->current_buffer_size_ms = |
220 static_cast<uint16_t>(num_samples_in_buffers * 1000 / fs_hz); | 220 static_cast<uint16_t>(num_samples_in_buffers * 1000 / fs_hz); |
221 const int ms_per_packet = rtc::checked_cast<int>( | 221 const int ms_per_packet = rtc::checked_cast<int>( |
222 decision_logic.packet_length_samples() / (fs_hz / 1000)); | 222 decision_logic.packet_length_samples() / (fs_hz / 1000)); |
223 stats->preferred_buffer_size_ms = (delay_manager.TargetLevel() >> 8) * | 223 stats->preferred_buffer_size_ms = (delay_manager.TargetLevel() >> 8) * |
224 ms_per_packet; | 224 ms_per_packet; |
225 stats->jitter_peaks_found = delay_manager.PeakFound(); | 225 stats->jitter_peaks_found = delay_manager.PeakFound(); |
226 stats->clockdrift_ppm = delay_manager.AverageIAT(); | 226 stats->clockdrift_ppm = |
| 227 rtc::saturated_cast<int32_t>(delay_manager.EstimatedClockDriftPpm()); |
227 | 228 |
228 stats->packet_loss_rate = | 229 stats->packet_loss_rate = |
229 CalculateQ14Ratio(lost_timestamps_, timestamps_since_last_report_); | 230 CalculateQ14Ratio(lost_timestamps_, timestamps_since_last_report_); |
230 | 231 |
231 const size_t discarded_samples = discarded_packets_ * samples_per_packet; | 232 const size_t discarded_samples = discarded_packets_ * samples_per_packet; |
232 stats->packet_discard_rate = | 233 stats->packet_discard_rate = |
233 CalculateQ14Ratio(discarded_samples, timestamps_since_last_report_); | 234 CalculateQ14Ratio(discarded_samples, timestamps_since_last_report_); |
234 | 235 |
235 stats->accelerate_rate = | 236 stats->accelerate_rate = |
236 CalculateQ14Ratio(accelerate_samples_, timestamps_since_last_report_); | 237 CalculateQ14Ratio(accelerate_samples_, timestamps_since_last_report_); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Ratio must be smaller than 1 in Q14. | 288 // Ratio must be smaller than 1 in Q14. |
288 assert((numerator << 14) / denominator < (1 << 14)); | 289 assert((numerator << 14) / denominator < (1 << 14)); |
289 return static_cast<uint16_t>((numerator << 14) / denominator); | 290 return static_cast<uint16_t>((numerator << 14) / denominator); |
290 } else { | 291 } else { |
291 // Will not produce a ratio larger than 1, since this is probably an error. | 292 // Will not produce a ratio larger than 1, since this is probably an error. |
292 return 1 << 14; | 293 return 1 << 14; |
293 } | 294 } |
294 } | 295 } |
295 | 296 |
296 } // namespace webrtc | 297 } // namespace webrtc |
OLD | NEW |