OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 20 matching lines...) Expand all Loading... |
31 virtual ~RtcpBandwidthObserverImpl() { | 31 virtual ~RtcpBandwidthObserverImpl() { |
32 } | 32 } |
33 // Received RTCP REMB or TMMBR. | 33 // Received RTCP REMB or TMMBR. |
34 void OnReceivedEstimatedBitrate(uint32_t bitrate) override { | 34 void OnReceivedEstimatedBitrate(uint32_t bitrate) override { |
35 owner_->OnReceiverEstimatedBitrate(bitrate); | 35 owner_->OnReceiverEstimatedBitrate(bitrate); |
36 } | 36 } |
37 // Received RTCP receiver block. | 37 // Received RTCP receiver block. |
38 void OnReceivedRtcpReceiverReport(const ReportBlockList& report_blocks, | 38 void OnReceivedRtcpReceiverReport(const ReportBlockList& report_blocks, |
39 int64_t rtt, | 39 int64_t rtt, |
40 int64_t now_ms) override { | 40 int64_t now_ms) override { |
| 41 if (report_blocks.empty()) |
| 42 return; |
| 43 |
41 int fraction_lost_aggregate = 0; | 44 int fraction_lost_aggregate = 0; |
42 int total_number_of_packets = 0; | 45 int total_number_of_packets = 0; |
43 | 46 |
44 // Compute the a weighted average of the fraction loss from all report | 47 // Compute the a weighted average of the fraction loss from all report |
45 // blocks. | 48 // blocks. |
46 for (const RTCPReportBlock& report_block : report_blocks) { | 49 for (const RTCPReportBlock& report_block : report_blocks) { |
47 std::map<uint32_t, uint32_t>::iterator seq_num_it = | 50 std::map<uint32_t, uint32_t>::iterator seq_num_it = |
48 ssrc_to_last_received_extended_high_seq_num_.find( | 51 ssrc_to_last_received_extended_high_seq_num_.find( |
49 report_block.sourceSSRC); | 52 report_block.sourceSSRC); |
50 | 53 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 286 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
284 if (bitrate > 0) { | 287 if (bitrate > 0) { |
285 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 288 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
286 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 289 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
287 *bandwidth = bitrate; | 290 *bandwidth = bitrate; |
288 return true; | 291 return true; |
289 } | 292 } |
290 return false; | 293 return false; |
291 } | 294 } |
292 } // namespace webrtc | 295 } // namespace webrtc |
OLD | NEW |