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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 if (exp_since_last) { | 258 if (exp_since_last) { |
259 // Scale 0 to 255, where 255 is 100% loss. | 259 // Scale 0 to 255, where 255 is 100% loss. |
260 local_fraction_lost = | 260 local_fraction_lost = |
261 static_cast<uint8_t>(255 * missing / exp_since_last); | 261 static_cast<uint8_t>(255 * missing / exp_since_last); |
262 } | 262 } |
263 stats.fraction_lost = local_fraction_lost; | 263 stats.fraction_lost = local_fraction_lost; |
264 | 264 |
265 // We need a counter for cumulative loss too. | 265 // We need a counter for cumulative loss too. |
266 // TODO(danilchap): Ensure cumulative loss is below maximum value of 2^24. | 266 // TODO(danilchap): Ensure cumulative loss is below maximum value of 2^24. |
267 cumulative_loss_ += missing; | 267 cumulative_loss_ += missing; |
268 stats.cumulative_lost = cumulative_loss_; | 268 stats.packets_lost = cumulative_loss_; |
269 stats.extended_max_sequence_number = | 269 stats.extended_highest_sequence_number = |
270 (received_seq_wraps_ << 16) + received_seq_max_; | 270 (received_seq_wraps_ << 16) + received_seq_max_; |
271 // Note: internal jitter value is in Q4 and needs to be scaled by 1/16. | 271 // Note: internal jitter value is in Q4 and needs to be scaled by 1/16. |
272 stats.jitter = jitter_q4_ >> 4; | 272 stats.jitter = jitter_q4_ >> 4; |
273 | 273 |
274 // Store this report. | 274 // Store this report. |
275 last_reported_statistics_ = stats; | 275 last_reported_statistics_ = stats; |
276 | 276 |
277 // Only for report blocks in RTCP SR and RR. | 277 // Only for report blocks in RTCP SR and RR. |
278 last_report_inorder_packets_ = | 278 last_report_inorder_packets_ = |
279 receive_counters_.transmitted.packets - | 279 receive_counters_.transmitted.packets - |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 break; | 507 break; |
508 | 508 |
509 // Do we have receive statistics to send? | 509 // Do we have receive statistics to send? |
510 RtcpStatistics stats; | 510 RtcpStatistics stats; |
511 if (!statistician.second->GetStatistics(&stats, true)) | 511 if (!statistician.second->GetStatistics(&stats, true)) |
512 continue; | 512 continue; |
513 result.emplace_back(); | 513 result.emplace_back(); |
514 rtcp::ReportBlock& block = result.back(); | 514 rtcp::ReportBlock& block = result.back(); |
515 block.SetMediaSsrc(statistician.first); | 515 block.SetMediaSsrc(statistician.first); |
516 block.SetFractionLost(stats.fraction_lost); | 516 block.SetFractionLost(stats.fraction_lost); |
517 if (!block.SetCumulativeLost(stats.cumulative_lost)) { | 517 if (!block.SetCumulativeLost(stats.packets_lost)) { |
518 LOG(LS_WARNING) << "Cumulative lost is oversized."; | 518 LOG(LS_WARNING) << "Cumulative lost is oversized."; |
519 result.pop_back(); | 519 result.pop_back(); |
520 continue; | 520 continue; |
521 } | 521 } |
522 block.SetExtHighestSeqNum(stats.extended_max_sequence_number); | 522 block.SetExtHighestSeqNum(stats.extended_highest_sequence_number); |
523 block.SetJitter(stats.jitter); | 523 block.SetJitter(stats.jitter); |
524 } | 524 } |
525 return result; | 525 return result; |
526 } | 526 } |
527 | 527 |
528 } // namespace webrtc | 528 } // namespace webrtc |
OLD | NEW |