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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { | 174 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { |
175 uma_update_state_ = kDone; | 175 uma_update_state_ = kDone; |
176 int bitrate_diff_kbps = | 176 int bitrate_diff_kbps = |
177 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); | 177 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); |
178 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialVsConvergedDiff", | 178 RTC_HISTOGRAM_COUNTS_SPARSE("WebRTC.BWE.InitialVsConvergedDiff", |
179 bitrate_diff_kbps, 0, 2000, 50); | 179 bitrate_diff_kbps, 0, 2000, 50); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { | 183 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { |
184 // We trust the REMB during the first 2 seconds if we haven't had any | 184 // We trust the REMB and/or delay-based estimate during the first 2 seconds if |
185 // packet loss reported, to allow startup bitrate probing. | 185 // we haven't had any packet loss reported, to allow startup bitrate probing. |
186 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms) && | 186 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms)) { |
187 bwe_incoming_ > bitrate_) { | 187 uint32_t prev_bitrate = bitrate_; |
188 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); | 188 if (bwe_incoming_ > bitrate_) |
189 min_bitrate_history_.clear(); | 189 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); |
190 min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_)); | 190 if (delay_based_bitrate_bps_ > bitrate_) |
191 return; | 191 bitrate_ = CapBitrateToThresholds(now_ms, delay_based_bitrate_bps_); |
| 192 if (bitrate_ != prev_bitrate) { |
| 193 min_bitrate_history_.clear(); |
| 194 min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_)); |
| 195 return; |
| 196 } |
192 } | 197 } |
193 UpdateMinHistory(now_ms); | 198 UpdateMinHistory(now_ms); |
194 // Only start updating bitrate when receiving receiver blocks. | 199 // Only start updating bitrate when receiving receiver blocks. |
195 // TODO(pbos): Handle the case when no receiver report is received for a very | 200 // TODO(pbos): Handle the case when no receiver report is received for a very |
196 // long time. | 201 // long time. |
197 if (time_last_receiver_block_ms_ != -1) { | 202 if (time_last_receiver_block_ms_ != -1) { |
198 if (last_fraction_loss_ <= 5) { | 203 if (last_fraction_loss_ <= 5) { |
199 // Loss < 2%: Increase rate by 8% of the min bitrate in the last | 204 // Loss < 2%: Increase rate by 8% of the min bitrate in the last |
200 // kBweIncreaseIntervalMs. | 205 // kBweIncreaseIntervalMs. |
201 // Note that by remembering the bitrate over the last second one can | 206 // Note that by remembering the bitrate over the last second one can |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 bitrate = min_bitrate_configured_; | 298 bitrate = min_bitrate_configured_; |
294 } | 299 } |
295 return bitrate; | 300 return bitrate; |
296 } | 301 } |
297 | 302 |
298 void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) { | 303 void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) { |
299 event_log_ = event_log; | 304 event_log_ = event_log; |
300 } | 305 } |
301 | 306 |
302 } // namespace webrtc | 307 } // namespace webrtc |
OLD | NEW |