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 | |
44 int fraction_lost_aggregate = 0; | 41 int fraction_lost_aggregate = 0; |
45 int total_number_of_packets = 0; | 42 int total_number_of_packets = 0; |
46 | 43 |
47 // Compute the a weighted average of the fraction loss from all report | 44 // Compute the a weighted average of the fraction loss from all report |
48 // blocks. | 45 // blocks. |
49 for (const RTCPReportBlock& report_block : report_blocks) { | 46 for (const RTCPReportBlock& report_block : report_blocks) { |
50 std::map<uint32_t, uint32_t>::iterator seq_num_it = | 47 std::map<uint32_t, uint32_t>::iterator seq_num_it = |
51 ssrc_to_last_received_extended_high_seq_num_.find( | 48 ssrc_to_last_received_extended_high_seq_num_.find( |
52 report_block.sourceSSRC); | 49 report_block.sourceSSRC); |
53 | 50 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 284 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
288 if (bitrate > 0) { | 285 if (bitrate > 0) { |
289 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 286 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
290 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 287 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
291 *bandwidth = bitrate; | 288 *bandwidth = bitrate; |
292 return true; | 289 return true; |
293 } | 290 } |
294 return false; | 291 return false; |
295 } | 292 } |
296 } // namespace webrtc | 293 } // namespace webrtc |
OLD | NEW |