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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 uint8_t local_fraction_lost = 0; | 261 uint8_t local_fraction_lost = 0; |
262 if (exp_since_last) { | 262 if (exp_since_last) { |
263 // Scale 0 to 255, where 255 is 100% loss. | 263 // Scale 0 to 255, where 255 is 100% loss. |
264 local_fraction_lost = | 264 local_fraction_lost = |
265 static_cast<uint8_t>(255 * missing / exp_since_last); | 265 static_cast<uint8_t>(255 * missing / exp_since_last); |
266 } | 266 } |
267 stats.fraction_lost = local_fraction_lost; | 267 stats.fraction_lost = local_fraction_lost; |
268 | 268 |
269 // We need a counter for cumulative loss too. | 269 // We need a counter for cumulative loss too. |
| 270 // TODO(danilchap): Ensure cumulative loss is below maximum value of 2^24. |
270 cumulative_loss_ += missing; | 271 cumulative_loss_ += missing; |
271 stats.cumulative_lost = cumulative_loss_; | 272 stats.cumulative_lost = cumulative_loss_; |
272 stats.extended_max_sequence_number = | 273 stats.extended_max_sequence_number = |
273 (received_seq_wraps_ << 16) + received_seq_max_; | 274 (received_seq_wraps_ << 16) + received_seq_max_; |
274 // Note: internal jitter value is in Q4 and needs to be scaled by 1/16. | 275 // Note: internal jitter value is in Q4 and needs to be scaled by 1/16. |
275 stats.jitter = jitter_q4_ >> 4; | 276 stats.jitter = jitter_q4_ >> 4; |
276 | 277 |
277 // Store this report. | 278 // Store this report. |
278 last_reported_statistics_ = stats; | 279 last_reported_statistics_ = stats; |
279 | 280 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 540 |
540 int32_t NullReceiveStatistics::Process() { return 0; } | 541 int32_t NullReceiveStatistics::Process() { return 0; } |
541 | 542 |
542 void NullReceiveStatistics::RegisterRtcpStatisticsCallback( | 543 void NullReceiveStatistics::RegisterRtcpStatisticsCallback( |
543 RtcpStatisticsCallback* callback) {} | 544 RtcpStatisticsCallback* callback) {} |
544 | 545 |
545 void NullReceiveStatistics::RegisterRtpStatisticsCallback( | 546 void NullReceiveStatistics::RegisterRtpStatisticsCallback( |
546 StreamDataCountersCallback* callback) {} | 547 StreamDataCountersCallback* callback) {} |
547 | 548 |
548 } // namespace webrtc | 549 } // namespace webrtc |
OLD | NEW |