Adds support for sending first set of packets at increasingly higher bitrates to probe the link and faster ramp up to a high bitrate.

Also wires up a finch experiment to control this.

R=mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/30639004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7505 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2014-10-23 11:57:05 +00:00
parent 2192701135
commit 82462aade0
19 changed files with 959 additions and 212 deletions

View File

@ -56,7 +56,9 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation()
last_fraction_loss_(0),
last_round_trip_time_ms_(0),
bwe_incoming_(0),
time_last_decrease_ms_(0) {}
time_last_decrease_ms_(0),
first_report_time_ms_(-1) {
}
SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {}
@ -88,13 +90,15 @@ void SendSideBandwidthEstimation::CurrentEstimate(uint32_t* bitrate,
void SendSideBandwidthEstimation::UpdateReceiverEstimate(uint32_t bandwidth) {
bwe_incoming_ = bandwidth;
CapBitrateToThresholds();
bitrate_ = CapBitrateToThresholds(bitrate_);
}
void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
uint32_t rtt,
int number_of_packets,
uint32_t now_ms) {
if (first_report_time_ms_ == -1)
first_report_time_ms_ = now_ms;
// Update RTT.
last_round_trip_time_ms_ = rtt;
@ -124,8 +128,16 @@ void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
}
void SendSideBandwidthEstimation::UpdateEstimate(uint32_t now_ms) {
// We trust the REMB during the first 2 seconds if we haven't had any
// packet loss reported, to allow startup bitrate probing.
if (last_fraction_loss_ == 0 && now_ms - first_report_time_ms_ < 2000 &&
bwe_incoming_ > bitrate_) {
bitrate_ = CapBitrateToThresholds(bwe_incoming_);
min_bitrate_history_.clear();
min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_));
return;
}
UpdateMinHistory(now_ms);
// Only start updating bitrate when receiving receiver blocks.
if (time_last_receiver_block_ms_ != 0) {
if (last_fraction_loss_ <= 5) {
@ -172,7 +184,7 @@ void SendSideBandwidthEstimation::UpdateEstimate(uint32_t now_ms) {
}
}
}
CapBitrateToThresholds();
bitrate_ = CapBitrateToThresholds(bitrate_);
}
void SendSideBandwidthEstimation::UpdateMinHistory(uint32_t now_ms) {
@ -195,19 +207,20 @@ void SendSideBandwidthEstimation::UpdateMinHistory(uint32_t now_ms) {
min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_));
}
void SendSideBandwidthEstimation::CapBitrateToThresholds() {
if (bwe_incoming_ > 0 && bitrate_ > bwe_incoming_) {
bitrate_ = bwe_incoming_;
uint32_t SendSideBandwidthEstimation::CapBitrateToThresholds(uint32_t bitrate) {
if (bwe_incoming_ > 0 && bitrate > bwe_incoming_) {
bitrate = bwe_incoming_;
}
if (bitrate_ > max_bitrate_configured_) {
bitrate_ = max_bitrate_configured_;
if (bitrate > max_bitrate_configured_) {
bitrate = max_bitrate_configured_;
}
if (bitrate_ < min_bitrate_configured_) {
LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate_ / 1000
if (bitrate < min_bitrate_configured_) {
LOG(LS_WARNING) << "Estimated available bandwidth " << bitrate / 1000
<< " kbps is below configured min bitrate "
<< min_bitrate_configured_ / 1000 << " kbps.";
bitrate_ = min_bitrate_configured_;
bitrate = min_bitrate_configured_;
}
return bitrate;
}
} // namespace webrtc