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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 | 203 |
204 void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss, | 204 void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss, |
205 int64_t rtt, | 205 int64_t rtt, |
206 int number_of_packets, | 206 int number_of_packets, |
207 int64_t now_ms) { | 207 int64_t now_ms) { |
208 last_feedback_ms_ = now_ms; | 208 last_feedback_ms_ = now_ms; |
209 if (first_report_time_ms_ == -1) | 209 if (first_report_time_ms_ == -1) |
210 first_report_time_ms_ = now_ms; | 210 first_report_time_ms_ = now_ms; |
211 | 211 |
212 // Update RTT. | 212 // Update RTT if we were able to compute an RTT based on this RTCP. |
213 last_round_trip_time_ms_ = rtt; | 213 // FlexFEC doesn't send RTCP SR, which means we won't be able to compute RTT. |
| 214 if (rtt > 0) |
| 215 last_round_trip_time_ms_ = rtt; |
214 | 216 |
215 // Check sequence number diff and weight loss report | 217 // Check sequence number diff and weight loss report |
216 if (number_of_packets > 0) { | 218 if (number_of_packets > 0) { |
217 // Calculate number of lost packets. | 219 // Calculate number of lost packets. |
218 const int num_lost_packets_Q8 = fraction_loss * number_of_packets; | 220 const int num_lost_packets_Q8 = fraction_loss * number_of_packets; |
219 // Accumulate reports. | 221 // Accumulate reports. |
220 lost_packets_since_last_loss_update_Q8_ += num_lost_packets_Q8; | 222 lost_packets_since_last_loss_update_Q8_ += num_lost_packets_Q8; |
221 expected_packets_since_last_loss_update_ += number_of_packets; | 223 expected_packets_since_last_loss_update_ += number_of_packets; |
222 | 224 |
223 // Don't generate a loss rate until it can be based on enough packets. | 225 // Don't generate a loss rate until it can be based on enough packets. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 last_fraction_loss_ != last_logged_fraction_loss_ || | 413 last_fraction_loss_ != last_logged_fraction_loss_ || |
412 now_ms - last_rtc_event_log_ms_ > kRtcEventLogPeriodMs) { | 414 now_ms - last_rtc_event_log_ms_ > kRtcEventLogPeriodMs) { |
413 event_log_->LogLossBasedBweUpdate(bitrate_bps, last_fraction_loss_, | 415 event_log_->LogLossBasedBweUpdate(bitrate_bps, last_fraction_loss_, |
414 expected_packets_since_last_loss_update_); | 416 expected_packets_since_last_loss_update_); |
415 last_logged_fraction_loss_ = last_fraction_loss_; | 417 last_logged_fraction_loss_ = last_fraction_loss_; |
416 last_rtc_event_log_ms_ = now_ms; | 418 last_rtc_event_log_ms_ = now_ms; |
417 } | 419 } |
418 current_bitrate_bps_ = bitrate_bps; | 420 current_bitrate_bps_ = bitrate_bps; |
419 } | 421 } |
420 } // namespace webrtc | 422 } // namespace webrtc |
OLD | NEW |