Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc

Issue 2815843002: Log to RtcEventLog when loss based estimate is changed. (Closed)
Patch Set: Feedback Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 *low_loss_threshold = kDefaultLowLossThreshold; 97 *low_loss_threshold = kDefaultLowLossThreshold;
98 *high_loss_threshold = kDefaultHighLossThreshold; 98 *high_loss_threshold = kDefaultHighLossThreshold;
99 *bitrate_threshold_kbps = kDefaultBitrateThresholdKbps; 99 *bitrate_threshold_kbps = kDefaultBitrateThresholdKbps;
100 return false; 100 return false;
101 } 101 }
102 } // namespace 102 } // namespace
103 103
104 SendSideBandwidthEstimation::SendSideBandwidthEstimation(RtcEventLog* event_log) 104 SendSideBandwidthEstimation::SendSideBandwidthEstimation(RtcEventLog* event_log)
105 : lost_packets_since_last_loss_update_Q8_(0), 105 : lost_packets_since_last_loss_update_Q8_(0),
106 expected_packets_since_last_loss_update_(0), 106 expected_packets_since_last_loss_update_(0),
107 bitrate_(0), 107 current_bitrate_bps_(0),
108 min_bitrate_configured_(congestion_controller::GetMinBitrateBps()), 108 min_bitrate_configured_(congestion_controller::GetMinBitrateBps()),
109 max_bitrate_configured_(kDefaultMaxBitrateBps), 109 max_bitrate_configured_(kDefaultMaxBitrateBps),
110 last_low_bitrate_log_ms_(-1), 110 last_low_bitrate_log_ms_(-1),
111 has_decreased_since_last_fraction_loss_(false), 111 has_decreased_since_last_fraction_loss_(false),
112 last_feedback_ms_(-1), 112 last_feedback_ms_(-1),
113 last_packet_report_ms_(-1), 113 last_packet_report_ms_(-1),
114 last_timeout_ms_(-1), 114 last_timeout_ms_(-1),
115 last_fraction_loss_(0), 115 last_fraction_loss_(0),
116 last_logged_fraction_loss_(0), 116 last_logged_fraction_loss_(0),
117 last_round_trip_time_ms_(0), 117 last_round_trip_time_ms_(0),
(...skipping 24 matching lines...) Expand all
142 bitrate_threshold_bps_ = bitrate_threshold_kbps * 1000; 142 bitrate_threshold_bps_ = bitrate_threshold_kbps * 1000;
143 } 143 }
144 } 144 }
145 } 145 }
146 146
147 SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {} 147 SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
148 148
149 void SendSideBandwidthEstimation::SetBitrates(int send_bitrate, 149 void SendSideBandwidthEstimation::SetBitrates(int send_bitrate,
150 int min_bitrate, 150 int min_bitrate,
151 int max_bitrate) { 151 int max_bitrate) {
152 SetMinMaxBitrate(min_bitrate, max_bitrate);
152 if (send_bitrate > 0) 153 if (send_bitrate > 0)
153 SetSendBitrate(send_bitrate); 154 SetSendBitrate(send_bitrate);
154 SetMinMaxBitrate(min_bitrate, max_bitrate);
155 } 155 }
156 156
157 void SendSideBandwidthEstimation::SetSendBitrate(int bitrate) { 157 void SendSideBandwidthEstimation::SetSendBitrate(int bitrate) {
158 RTC_DCHECK_GT(bitrate, 0); 158 RTC_DCHECK_GT(bitrate, 0);
159 bitrate_ = bitrate; 159 CapBitrateToThresholds(Clock::GetRealTimeClock()->TimeInMilliseconds(),
160 160 bitrate);
161 // Clear last sent bitrate history so the new value can be used directly 161 // Clear last sent bitrate history so the new value can be used directly
162 // and not capped. 162 // and not capped.
163 min_bitrate_history_.clear(); 163 min_bitrate_history_.clear();
164 } 164 }
165 165
166 void SendSideBandwidthEstimation::SetMinMaxBitrate(int min_bitrate, 166 void SendSideBandwidthEstimation::SetMinMaxBitrate(int min_bitrate,
167 int max_bitrate) { 167 int max_bitrate) {
168 RTC_DCHECK_GE(min_bitrate, 0); 168 RTC_DCHECK_GE(min_bitrate, 0);
169 min_bitrate_configured_ = 169 min_bitrate_configured_ =
170 std::max(min_bitrate, congestion_controller::GetMinBitrateBps()); 170 std::max(min_bitrate, congestion_controller::GetMinBitrateBps());
171 if (max_bitrate > 0) { 171 if (max_bitrate > 0) {
172 max_bitrate_configured_ = 172 max_bitrate_configured_ =
173 std::max<uint32_t>(min_bitrate_configured_, max_bitrate); 173 std::max<uint32_t>(min_bitrate_configured_, max_bitrate);
174 } else { 174 } else {
175 max_bitrate_configured_ = kDefaultMaxBitrateBps; 175 max_bitrate_configured_ = kDefaultMaxBitrateBps;
176 } 176 }
177 } 177 }
178 178
179 int SendSideBandwidthEstimation::GetMinBitrate() const { 179 int SendSideBandwidthEstimation::GetMinBitrate() const {
180 return min_bitrate_configured_; 180 return min_bitrate_configured_;
181 } 181 }
182 182
183 void SendSideBandwidthEstimation::CurrentEstimate(int* bitrate, 183 void SendSideBandwidthEstimation::CurrentEstimate(int* bitrate,
184 uint8_t* loss, 184 uint8_t* loss,
185 int64_t* rtt) const { 185 int64_t* rtt) const {
186 *bitrate = bitrate_; 186 *bitrate = current_bitrate_bps_;
187 *loss = last_fraction_loss_; 187 *loss = last_fraction_loss_;
188 *rtt = last_round_trip_time_ms_; 188 *rtt = last_round_trip_time_ms_;
189 } 189 }
190 190
191 void SendSideBandwidthEstimation::UpdateReceiverEstimate( 191 void SendSideBandwidthEstimation::UpdateReceiverEstimate(
192 int64_t now_ms, uint32_t bandwidth) { 192 int64_t now_ms, uint32_t bandwidth) {
193 bwe_incoming_ = bandwidth; 193 bwe_incoming_ = bandwidth;
194 bitrate_ = CapBitrateToThresholds(now_ms, bitrate_); 194 CapBitrateToThresholds(now_ms, current_bitrate_bps_);
195 } 195 }
196 196
197 void SendSideBandwidthEstimation::UpdateDelayBasedEstimate( 197 void SendSideBandwidthEstimation::UpdateDelayBasedEstimate(
198 int64_t now_ms, 198 int64_t now_ms,
199 uint32_t bitrate_bps) { 199 uint32_t bitrate_bps) {
200 delay_based_bitrate_bps_ = bitrate_bps; 200 delay_based_bitrate_bps_ = bitrate_bps;
201 bitrate_ = CapBitrateToThresholds(now_ms, bitrate_); 201 CapBitrateToThresholds(now_ms, current_bitrate_bps_);
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
(...skipping 21 matching lines...) Expand all
233 expected_packets_since_last_loss_update_ = 0; 233 expected_packets_since_last_loss_update_ = 0;
234 last_packet_report_ms_ = now_ms; 234 last_packet_report_ms_ = now_ms;
235 UpdateEstimate(now_ms); 235 UpdateEstimate(now_ms);
236 } 236 }
237 UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8); 237 UpdateUmaStats(now_ms, rtt, (fraction_loss * number_of_packets) >> 8);
238 } 238 }
239 239
240 void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms, 240 void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
241 int64_t rtt, 241 int64_t rtt,
242 int lost_packets) { 242 int lost_packets) {
243 int bitrate_kbps = static_cast<int>((bitrate_ + 500) / 1000); 243 int bitrate_kbps = static_cast<int>((current_bitrate_bps_ + 500) / 1000);
244 for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) { 244 for (size_t i = 0; i < kNumUmaRampupMetrics; ++i) {
245 if (!rampup_uma_stats_updated_[i] && 245 if (!rampup_uma_stats_updated_[i] &&
246 bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) { 246 bitrate_kbps >= kUmaRampupMetrics[i].bitrate_kbps) {
247 RTC_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name, 247 RTC_HISTOGRAMS_COUNTS_100000(i, kUmaRampupMetrics[i].metric_name,
248 now_ms - first_report_time_ms_); 248 now_ms - first_report_time_ms_);
249 rampup_uma_stats_updated_[i] = true; 249 rampup_uma_stats_updated_[i] = true;
250 } 250 }
251 } 251 }
252 if (IsInStartPhase(now_ms)) { 252 if (IsInStartPhase(now_ms)) {
253 initially_lost_packets_ += lost_packets; 253 initially_lost_packets_ += lost_packets;
(...skipping 10 matching lines...) Expand all
264 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) { 264 now_ms - first_report_time_ms_ >= kBweConverganceTimeMs) {
265 uma_update_state_ = kDone; 265 uma_update_state_ = kDone;
266 int bitrate_diff_kbps = 266 int bitrate_diff_kbps =
267 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0); 267 std::max(bitrate_at_2_seconds_kbps_ - bitrate_kbps, 0);
268 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps, 268 RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialVsConvergedDiff", bitrate_diff_kbps,
269 0, 2000, 50); 269 0, 2000, 50);
270 } 270 }
271 } 271 }
272 272
273 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) { 273 void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
274 uint32_t new_bitrate = current_bitrate_bps_;
274 // We trust the REMB and/or delay-based estimate during the first 2 seconds if 275 // We trust the REMB and/or delay-based estimate during the first 2 seconds if
275 // we haven't had any packet loss reported, to allow startup bitrate probing. 276 // we haven't had any packet loss reported, to allow startup bitrate probing.
276 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms)) { 277 if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms)) {
277 uint32_t prev_bitrate = bitrate_; 278 new_bitrate = std::max(bwe_incoming_, new_bitrate);
278 if (bwe_incoming_ > bitrate_) 279 new_bitrate = std::max(delay_based_bitrate_bps_, new_bitrate);
279 bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_); 280
280 if (delay_based_bitrate_bps_ > bitrate_) { 281 if (new_bitrate != current_bitrate_bps_) {
281 bitrate_ = CapBitrateToThresholds(now_ms, delay_based_bitrate_bps_);
282 }
283 if (bitrate_ != prev_bitrate) {
284 min_bitrate_history_.clear(); 282 min_bitrate_history_.clear();
285 min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_)); 283 min_bitrate_history_.push_back(
284 std::make_pair(now_ms, current_bitrate_bps_));
285 CapBitrateToThresholds(now_ms, new_bitrate);
286 return; 286 return;
287 } 287 }
288 } 288 }
289 UpdateMinHistory(now_ms); 289 UpdateMinHistory(now_ms);
290 if (last_packet_report_ms_ == -1) { 290 if (last_packet_report_ms_ == -1) {
291 // No feedback received. 291 // No feedback received.
292 bitrate_ = CapBitrateToThresholds(now_ms, bitrate_); 292 CapBitrateToThresholds(now_ms, current_bitrate_bps_);
293 return; 293 return;
294 } 294 }
295 int64_t time_since_packet_report_ms = now_ms - last_packet_report_ms_; 295 int64_t time_since_packet_report_ms = now_ms - last_packet_report_ms_;
296 int64_t time_since_feedback_ms = now_ms - last_feedback_ms_; 296 int64_t time_since_feedback_ms = now_ms - last_feedback_ms_;
297 if (time_since_packet_report_ms < 1.2 * kFeedbackIntervalMs) { 297 if (time_since_packet_report_ms < 1.2 * kFeedbackIntervalMs) {
298 // We only care about loss above a given bitrate threshold. 298 // We only care about loss above a given bitrate threshold.
299 float loss = last_fraction_loss_ / 256.0f; 299 float loss = last_fraction_loss_ / 256.0f;
300 // We only make decisions based on loss when the bitrate is above a 300 // We only make decisions based on loss when the bitrate is above a
301 // threshold. This is a crude way of handling loss which is uncorrelated 301 // threshold. This is a crude way of handling loss which is uncorrelated
302 // to congestion. 302 // to congestion.
303 if (bitrate_ < bitrate_threshold_bps_ || loss <= low_loss_threshold_) { 303 if (current_bitrate_bps_ < bitrate_threshold_bps_ ||
304 loss <= low_loss_threshold_) {
304 // Loss < 2%: Increase rate by 8% of the min bitrate in the last 305 // Loss < 2%: Increase rate by 8% of the min bitrate in the last
305 // kBweIncreaseIntervalMs. 306 // kBweIncreaseIntervalMs.
306 // Note that by remembering the bitrate over the last second one can 307 // Note that by remembering the bitrate over the last second one can
307 // rampup up one second faster than if only allowed to start ramping 308 // rampup up one second faster than if only allowed to start ramping
308 // at 8% per second rate now. E.g.: 309 // at 8% per second rate now. E.g.:
309 // If sending a constant 100kbps it can rampup immediatly to 108kbps 310 // If sending a constant 100kbps it can rampup immediatly to 108kbps
310 // whenever a receiver report is received with lower packet loss. 311 // whenever a receiver report is received with lower packet loss.
311 // If instead one would do: bitrate_ *= 1.08^(delta time), it would 312 // If instead one would do: current_bitrate_bps_ *= 1.08^(delta time),
312 // take over one second since the lower packet loss to achieve 313 // it would take over one second since the lower packet loss to achieve
313 // 108kbps. 314 // 108kbps.
314 bitrate_ = static_cast<uint32_t>( 315 new_bitrate = static_cast<uint32_t>(
315 min_bitrate_history_.front().second * 1.08 + 0.5); 316 min_bitrate_history_.front().second * 1.08 + 0.5);
316 317
317 // Add 1 kbps extra, just to make sure that we do not get stuck 318 // Add 1 kbps extra, just to make sure that we do not get stuck
318 // (gives a little extra increase at low rates, negligible at higher 319 // (gives a little extra increase at low rates, negligible at higher
319 // rates). 320 // rates).
320 bitrate_ += 1000; 321 new_bitrate += 1000;
321 } else if (bitrate_ > bitrate_threshold_bps_) { 322 } else if (current_bitrate_bps_ > bitrate_threshold_bps_) {
322 if (loss <= high_loss_threshold_) { 323 if (loss <= high_loss_threshold_) {
323 // Loss between 2% - 10%: Do nothing. 324 // Loss between 2% - 10%: Do nothing.
324 } else { 325 } else {
325 // Loss > 10%: Limit the rate decreases to once a kBweDecreaseIntervalMs 326 // Loss > 10%: Limit the rate decreases to once a kBweDecreaseIntervalMs
326 // + rtt. 327 // + rtt.
327 if (!has_decreased_since_last_fraction_loss_ && 328 if (!has_decreased_since_last_fraction_loss_ &&
328 (now_ms - time_last_decrease_ms_) >= 329 (now_ms - time_last_decrease_ms_) >=
329 (kBweDecreaseIntervalMs + last_round_trip_time_ms_)) { 330 (kBweDecreaseIntervalMs + last_round_trip_time_ms_)) {
330 time_last_decrease_ms_ = now_ms; 331 time_last_decrease_ms_ = now_ms;
331 332
332 // Reduce rate: 333 // Reduce rate:
333 // newRate = rate * (1 - 0.5*lossRate); 334 // newRate = rate * (1 - 0.5*lossRate);
334 // where packetLoss = 256*lossRate; 335 // where packetLoss = 256*lossRate;
335 bitrate_ = static_cast<uint32_t>( 336 new_bitrate = static_cast<uint32_t>(
336 (bitrate_ * static_cast<double>(512 - last_fraction_loss_)) / 337 (current_bitrate_bps_ *
338 static_cast<double>(512 - last_fraction_loss_)) /
337 512.0); 339 512.0);
338 has_decreased_since_last_fraction_loss_ = true; 340 has_decreased_since_last_fraction_loss_ = true;
339 } 341 }
340 } 342 }
341 } 343 }
342 } else if (time_since_feedback_ms > 344 } else if (time_since_feedback_ms >
343 kFeedbackTimeoutIntervals * kFeedbackIntervalMs && 345 kFeedbackTimeoutIntervals * kFeedbackIntervalMs &&
344 (last_timeout_ms_ == -1 || 346 (last_timeout_ms_ == -1 ||
345 now_ms - last_timeout_ms_ > kTimeoutIntervalMs)) { 347 now_ms - last_timeout_ms_ > kTimeoutIntervalMs)) {
346 if (in_timeout_experiment_) { 348 if (in_timeout_experiment_) {
347 LOG(LS_WARNING) << "Feedback timed out (" << time_since_feedback_ms 349 LOG(LS_WARNING) << "Feedback timed out (" << time_since_feedback_ms
348 << " ms), reducing bitrate."; 350 << " ms), reducing bitrate.";
349 bitrate_ *= 0.8; 351 new_bitrate *= 0.8;
350 // Reset accumulators since we've already acted on missing feedback and 352 // Reset accumulators since we've already acted on missing feedback and
351 // shouldn't to act again on these old lost packets. 353 // shouldn't to act again on these old lost packets.
352 lost_packets_since_last_loss_update_Q8_ = 0; 354 lost_packets_since_last_loss_update_Q8_ = 0;
353 expected_packets_since_last_loss_update_ = 0; 355 expected_packets_since_last_loss_update_ = 0;
354 last_timeout_ms_ = now_ms; 356 last_timeout_ms_ = now_ms;
355 } 357 }
356 } 358 }
357 uint32_t capped_bitrate = CapBitrateToThresholds(now_ms, bitrate_); 359
358 if (capped_bitrate != bitrate_ || 360 CapBitrateToThresholds(now_ms, new_bitrate);
359 last_fraction_loss_ != last_logged_fraction_loss_ ||
360 last_rtc_event_log_ms_ == -1 ||
361 now_ms - last_rtc_event_log_ms_ > kRtcEventLogPeriodMs) {
362 event_log_->LogLossBasedBweUpdate(capped_bitrate, last_fraction_loss_,
363 expected_packets_since_last_loss_update_);
364 last_logged_fraction_loss_ = last_fraction_loss_;
365 last_rtc_event_log_ms_ = now_ms;
366 }
367 bitrate_ = capped_bitrate;
368 } 361 }
369 362
370 bool SendSideBandwidthEstimation::IsInStartPhase(int64_t now_ms) const { 363 bool SendSideBandwidthEstimation::IsInStartPhase(int64_t now_ms) const {
371 return first_report_time_ms_ == -1 || 364 return first_report_time_ms_ == -1 ||
372 now_ms - first_report_time_ms_ < kStartPhaseMs; 365 now_ms - first_report_time_ms_ < kStartPhaseMs;
373 } 366 }
374 367
375 void SendSideBandwidthEstimation::UpdateMinHistory(int64_t now_ms) { 368 void SendSideBandwidthEstimation::UpdateMinHistory(int64_t now_ms) {
376 // Remove old data points from history. 369 // Remove old data points from history.
377 // Since history precision is in ms, add one so it is able to increase 370 // Since history precision is in ms, add one so it is able to increase
378 // bitrate if it is off by as little as 0.5ms. 371 // bitrate if it is off by as little as 0.5ms.
379 while (!min_bitrate_history_.empty() && 372 while (!min_bitrate_history_.empty() &&
380 now_ms - min_bitrate_history_.front().first + 1 > 373 now_ms - min_bitrate_history_.front().first + 1 >
381 kBweIncreaseIntervalMs) { 374 kBweIncreaseIntervalMs) {
382 min_bitrate_history_.pop_front(); 375 min_bitrate_history_.pop_front();
383 } 376 }
384 377
385 // Typical minimum sliding-window algorithm: Pop values higher than current 378 // Typical minimum sliding-window algorithm: Pop values higher than current
386 // bitrate before pushing it. 379 // bitrate before pushing it.
387 while (!min_bitrate_history_.empty() && 380 while (!min_bitrate_history_.empty() &&
388 bitrate_ <= min_bitrate_history_.back().second) { 381 current_bitrate_bps_ <= min_bitrate_history_.back().second) {
389 min_bitrate_history_.pop_back(); 382 min_bitrate_history_.pop_back();
390 } 383 }
391 384
392 min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_)); 385 min_bitrate_history_.push_back(std::make_pair(now_ms, current_bitrate_bps_));
393 } 386 }
394 387
395 uint32_t SendSideBandwidthEstimation::CapBitrateToThresholds( 388 void SendSideBandwidthEstimation::CapBitrateToThresholds(int64_t now_ms,
396 int64_t now_ms, uint32_t bitrate) { 389 uint32_t bitrate_bps) {
397 if (bwe_incoming_ > 0 && bitrate > bwe_incoming_) { 390 if (bwe_incoming_ > 0 && bitrate_bps > bwe_incoming_) {
398 bitrate = bwe_incoming_; 391 bitrate_bps = bwe_incoming_;
399 } 392 }
400 if (delay_based_bitrate_bps_ > 0 && bitrate > delay_based_bitrate_bps_) { 393 if (delay_based_bitrate_bps_ > 0 && bitrate_bps > delay_based_bitrate_bps_) {
401 bitrate = delay_based_bitrate_bps_; 394 bitrate_bps = delay_based_bitrate_bps_;
402 } 395 }
403 if (bitrate > max_bitrate_configured_) { 396 if (bitrate_bps > max_bitrate_configured_) {
404 bitrate = max_bitrate_configured_; 397 bitrate_bps = max_bitrate_configured_;
405 } 398 }
406 if (bitrate < min_bitrate_configured_) { 399 if (bitrate_bps < min_bitrate_configured_) {
407 if (last_low_bitrate_log_ms_ == -1 || 400 if (last_low_bitrate_log_ms_ == -1 ||
408 now_ms - last_low_bitrate_log_ms_ > kLowBitrateLogPeriodMs) { 401 now_ms - last_low_bitrate_log_ms_ > kLowBitrateLogPeriodMs) {
409 LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate / 1000 402 LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate_bps / 1000
410 << " kbps is below configured min bitrate " 403 << " kbps is below configured min bitrate "
411 << min_bitrate_configured_ / 1000 << " kbps."; 404 << min_bitrate_configured_ / 1000 << " kbps.";
412 last_low_bitrate_log_ms_ = now_ms; 405 last_low_bitrate_log_ms_ = now_ms;
413 } 406 }
414 bitrate = min_bitrate_configured_; 407 bitrate_bps = min_bitrate_configured_;
415 } 408 }
416 return bitrate; 409
410 if (bitrate_bps != current_bitrate_bps_ ||
411 last_fraction_loss_ != last_logged_fraction_loss_ ||
412 now_ms - last_rtc_event_log_ms_ > kRtcEventLogPeriodMs) {
413 event_log_->LogLossBasedBweUpdate(bitrate_bps, last_fraction_loss_,
414 expected_packets_since_last_loss_update_);
415 last_logged_fraction_loss_ = last_fraction_loss_;
416 last_rtc_event_log_ms_ = now_ms;
417 }
418 current_bitrate_bps_ = bitrate_bps;
417 } 419 }
418 } // namespace webrtc 420 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698