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

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

Issue 1581113006: Support REMB in combination with send-side BWE. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added comment. Created 4 years, 11 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 expected_packets_since_last_loss_update_(0), 48 expected_packets_since_last_loss_update_(0),
49 bitrate_(0), 49 bitrate_(0),
50 min_bitrate_configured_(kDefaultMinBitrateBps), 50 min_bitrate_configured_(kDefaultMinBitrateBps),
51 max_bitrate_configured_(kDefaultMaxBitrateBps), 51 max_bitrate_configured_(kDefaultMaxBitrateBps),
52 last_low_bitrate_log_ms_(-1), 52 last_low_bitrate_log_ms_(-1),
53 has_decreased_since_last_fraction_loss_(false), 53 has_decreased_since_last_fraction_loss_(false),
54 time_last_receiver_block_ms_(-1), 54 time_last_receiver_block_ms_(-1),
55 last_fraction_loss_(0), 55 last_fraction_loss_(0),
56 last_round_trip_time_ms_(0), 56 last_round_trip_time_ms_(0),
57 bwe_incoming_(0), 57 bwe_incoming_(0),
58 delay_based_bitrate_bps_(0),
58 time_last_decrease_ms_(0), 59 time_last_decrease_ms_(0),
59 first_report_time_ms_(-1), 60 first_report_time_ms_(-1),
60 initially_lost_packets_(0), 61 initially_lost_packets_(0),
61 bitrate_at_2_seconds_kbps_(0), 62 bitrate_at_2_seconds_kbps_(0),
62 uma_update_state_(kNoUpdate), 63 uma_update_state_(kNoUpdate),
63 rampup_uma_stats_updated_(kNumUmaRampupMetrics, false), 64 rampup_uma_stats_updated_(kNumUmaRampupMetrics, false),
64 event_log_(nullptr) {} 65 event_log_(nullptr) {}
65 66
66 SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {} 67 SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
67 68
(...skipping 29 matching lines...) Expand all
97 *loss = last_fraction_loss_; 98 *loss = last_fraction_loss_;
98 *rtt = last_round_trip_time_ms_; 99 *rtt = last_round_trip_time_ms_;
99 } 100 }
100 101
101 void SendSideBandwidthEstimation::UpdateReceiverEstimate( 102 void SendSideBandwidthEstimation::UpdateReceiverEstimate(
102 int64_t now_ms, uint32_t bandwidth) { 103 int64_t now_ms, uint32_t bandwidth) {
103 bwe_incoming_ = bandwidth; 104 bwe_incoming_ = bandwidth;
104 bitrate_ = CapBitrateToThresholds(now_ms, bitrate_); 105 bitrate_ = CapBitrateToThresholds(now_ms, bitrate_);
105 } 106 }
106 107
108 void SendSideBandwidthEstimation::UpdateDelayBasedEstimate(
109 int64_t now_ms,
110 uint32_t bitrate_bps) {
111 delay_based_bitrate_bps_ = bitrate_bps;
112 bitrate_ = CapBitrateToThresholds(now_ms, bitrate_);
113 }
114
107 void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss, 115 void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
108 int64_t rtt, 116 int64_t rtt,
109 int number_of_packets, 117 int number_of_packets,
110 int64_t now_ms) { 118 int64_t now_ms) {
111 if (first_report_time_ms_ == -1) 119 if (first_report_time_ms_ == -1)
112 first_report_time_ms_ = now_ms; 120 first_report_time_ms_ = now_ms;
113 121
114 // Update RTT. 122 // Update RTT.
115 last_round_trip_time_ms_ = rtt; 123 last_round_trip_time_ms_ = rtt;
116 124
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 269 }
262 270
263 min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_)); 271 min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_));
264 } 272 }
265 273
266 uint32_t SendSideBandwidthEstimation::CapBitrateToThresholds( 274 uint32_t SendSideBandwidthEstimation::CapBitrateToThresholds(
267 int64_t now_ms, uint32_t bitrate) { 275 int64_t now_ms, uint32_t bitrate) {
268 if (bwe_incoming_ > 0 && bitrate > bwe_incoming_) { 276 if (bwe_incoming_ > 0 && bitrate > bwe_incoming_) {
269 bitrate = bwe_incoming_; 277 bitrate = bwe_incoming_;
270 } 278 }
279 if (delay_based_bitrate_bps_ > 0 && bitrate > delay_based_bitrate_bps_) {
280 bitrate = delay_based_bitrate_bps_;
281 }
271 if (bitrate > max_bitrate_configured_) { 282 if (bitrate > max_bitrate_configured_) {
272 bitrate = max_bitrate_configured_; 283 bitrate = max_bitrate_configured_;
273 } 284 }
274 if (bitrate < min_bitrate_configured_) { 285 if (bitrate < min_bitrate_configured_) {
275 if (last_low_bitrate_log_ms_ == -1 || 286 if (last_low_bitrate_log_ms_ == -1 ||
276 now_ms - last_low_bitrate_log_ms_ > kLowBitrateLogPeriodMs) { 287 now_ms - last_low_bitrate_log_ms_ > kLowBitrateLogPeriodMs) {
277 LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate / 1000 288 LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate / 1000
278 << " kbps is below configured min bitrate " 289 << " kbps is below configured min bitrate "
279 << min_bitrate_configured_ / 1000 << " kbps."; 290 << min_bitrate_configured_ / 1000 << " kbps.";
280 last_low_bitrate_log_ms_ = now_ms; 291 last_low_bitrate_log_ms_ = now_ms;
281 } 292 }
282 bitrate = min_bitrate_configured_; 293 bitrate = min_bitrate_configured_;
283 } 294 }
284 return bitrate; 295 return bitrate;
285 } 296 }
286 297
287 void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) { 298 void SendSideBandwidthEstimation::SetEventLog(RtcEventLog* event_log) {
288 event_log_ = event_log; 299 event_log_ = event_log;
289 } 300 }
290 301
291 } // namespace webrtc 302 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698