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

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

Issue 2353033005: Refactoring: move ownership of RtcEventLog from Call to PeerConnection (Closed)
Patch Set: Moved DEPS entry to subdirectory Created 4 years, 2 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 time_last_decrease_ms_(0), 68 time_last_decrease_ms_(0),
69 first_report_time_ms_(-1), 69 first_report_time_ms_(-1),
70 initially_lost_packets_(0), 70 initially_lost_packets_(0),
71 bitrate_at_2_seconds_kbps_(0), 71 bitrate_at_2_seconds_kbps_(0),
72 uma_update_state_(kNoUpdate), 72 uma_update_state_(kNoUpdate),
73 rampup_uma_stats_updated_(kNumUmaRampupMetrics, false), 73 rampup_uma_stats_updated_(kNumUmaRampupMetrics, false),
74 event_log_(event_log), 74 event_log_(event_log),
75 last_rtc_event_log_ms_(-1), 75 last_rtc_event_log_ms_(-1),
76 in_timeout_experiment_(webrtc::field_trial::FindFullName( 76 in_timeout_experiment_(webrtc::field_trial::FindFullName(
77 "WebRTC-SendSideBwe") == "Enabled") { 77 "WebRTC-SendSideBwe") == "Enabled") {
78 RTC_DCHECK(event_log);
79 } 78 }
80 79
81 SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {} 80 SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
82 81
83 void SendSideBandwidthEstimation::SetBitrates(int send_bitrate, 82 void SendSideBandwidthEstimation::SetBitrates(int send_bitrate,
84 int min_bitrate, 83 int min_bitrate,
85 int max_bitrate) { 84 int max_bitrate) {
86 if (send_bitrate > 0) 85 if (send_bitrate > 0)
87 SetSendBitrate(send_bitrate); 86 SetSendBitrate(send_bitrate);
88 SetMinMaxBitrate(min_bitrate, max_bitrate); 87 SetMinMaxBitrate(min_bitrate, max_bitrate);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 << " ms), reducing bitrate."; 273 << " ms), reducing bitrate.";
275 bitrate_ *= 0.8; 274 bitrate_ *= 0.8;
276 // Reset accumulators since we've already acted on missing feedback and 275 // Reset accumulators since we've already acted on missing feedback and
277 // shouldn't to act again on these old lost packets. 276 // shouldn't to act again on these old lost packets.
278 lost_packets_since_last_loss_update_Q8_ = 0; 277 lost_packets_since_last_loss_update_Q8_ = 0;
279 expected_packets_since_last_loss_update_ = 0; 278 expected_packets_since_last_loss_update_ = 0;
280 last_timeout_ms_ = now_ms; 279 last_timeout_ms_ = now_ms;
281 } 280 }
282 } 281 }
283 uint32_t capped_bitrate = CapBitrateToThresholds(now_ms, bitrate_); 282 uint32_t capped_bitrate = CapBitrateToThresholds(now_ms, bitrate_);
284 if (capped_bitrate != bitrate_ || 283 if (event_log_ && (capped_bitrate != bitrate_ ||
285 last_fraction_loss_ != last_logged_fraction_loss_ || 284 last_fraction_loss_ != last_logged_fraction_loss_ ||
286 last_rtc_event_log_ms_ == -1 || 285 last_rtc_event_log_ms_ == -1 ||
287 now_ms - last_rtc_event_log_ms_ > kRtcEventLogPeriodMs) { 286 now_ms - last_rtc_event_log_ms_ > kRtcEventLogPeriodMs)) {
288 event_log_->LogBwePacketLossEvent(capped_bitrate, last_fraction_loss_, 287 event_log_->LogBwePacketLossEvent(capped_bitrate, last_fraction_loss_,
289 expected_packets_since_last_loss_update_); 288 expected_packets_since_last_loss_update_);
290 last_logged_fraction_loss_ = last_fraction_loss_; 289 last_logged_fraction_loss_ = last_fraction_loss_;
291 last_rtc_event_log_ms_ = now_ms; 290 last_rtc_event_log_ms_ = now_ms;
292 } 291 }
293 bitrate_ = capped_bitrate; 292 bitrate_ = capped_bitrate;
294 } 293 }
295 294
296 bool SendSideBandwidthEstimation::IsInStartPhase(int64_t now_ms) const { 295 bool SendSideBandwidthEstimation::IsInStartPhase(int64_t now_ms) const {
297 return first_report_time_ms_ == -1 || 296 return first_report_time_ms_ == -1 ||
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate / 1000 334 LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate / 1000
336 << " kbps is below configured min bitrate " 335 << " kbps is below configured min bitrate "
337 << min_bitrate_configured_ / 1000 << " kbps."; 336 << min_bitrate_configured_ / 1000 << " kbps.";
338 last_low_bitrate_log_ms_ = now_ms; 337 last_low_bitrate_log_ms_ = now_ms;
339 } 338 }
340 bitrate = min_bitrate_configured_; 339 bitrate = min_bitrate_configured_;
341 } 340 }
342 return bitrate; 341 return bitrate;
343 } 342 }
344 } // namespace webrtc 343 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698