Using early acknowledged rate for safe reset in GoogCC.

This won't be perfect since the peeked value will be noisy, but since we
cap it with the starting rate, it should only improve things.

Bug: webrtc:9718
Change-Id: Id2cf42fb85c8d7126f6d538a3982d65caa7a75b7
Reviewed-on: https://webrtc-review.googlesource.com/c/109926
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25604}
This commit is contained in:
Sebastian Jansson
2018-11-12 10:24:25 +01:00
committed by Commit Bot
parent f1cc3a26cd
commit 6b64c43cfd
6 changed files with 36 additions and 11 deletions

View File

@ -68,6 +68,10 @@ absl::optional<uint32_t> AcknowledgedBitrateEstimator::bitrate_bps() const {
}
}
absl::optional<uint32_t> AcknowledgedBitrateEstimator::PeekBps() const {
return bitrate_estimator_->PeekBps();
}
void AcknowledgedBitrateEstimator::SetAlrEndedTimeMs(
int64_t alr_ended_time_ms) {
alr_ended_time_ms_.emplace(alr_ended_time_ms);

View File

@ -32,6 +32,7 @@ class AcknowledgedBitrateEstimator {
void IncomingPacketFeedbackVector(
const std::vector<PacketFeedback>& packet_feedback_vector);
absl::optional<uint32_t> bitrate_bps() const;
absl::optional<uint32_t> PeekBps() const;
void SetAlrEndedTimeMs(int64_t alr_ended_time_ms);
void SetAllocatedBitrateWithoutFeedback(uint32_t bitrate_bps);

View File

@ -132,6 +132,12 @@ absl::optional<uint32_t> BitrateEstimator::bitrate_bps() const {
return bitrate_estimate_ * 1000;
}
absl::optional<uint32_t> BitrateEstimator::PeekBps() const {
if (current_window_ms_ > 0)
return sum_ * 8000 / current_window_ms_;
return absl::nullopt;
}
void BitrateEstimator::ExpectFastRateChange() {
// By setting the bitrate-estimate variance to a higher value we allow the
// bitrate to change fast for the next few samples.

View File

@ -29,6 +29,7 @@ class BitrateEstimator {
virtual void Update(int64_t now_ms, int bytes);
virtual absl::optional<uint32_t> bitrate_bps() const;
absl::optional<uint32_t> PeekBps() const;
virtual void ExpectFastRateChange();

View File

@ -132,8 +132,8 @@ GoogCcNetworkController::GoogCcNetworkController(RtcEventLog* event_log,
bool feedback_only)
: event_log_(event_log),
packet_feedback_only_(feedback_only),
safe_reset_on_route_change_(
field_trial::IsEnabled("WebRTC-Bwe-SafeResetOnRouteChange")),
safe_reset_on_route_change_("Enabled"),
safe_reset_acknowledged_rate_("ack"),
probe_controller_(new ProbeController()),
congestion_window_pushback_controller_(
MaybeInitalizeCongestionWindowPushbackController()),
@ -155,6 +155,10 @@ GoogCcNetworkController::GoogCcNetworkController(RtcEventLog* event_log,
in_cwnd_experiment_(CwndExperimentEnabled()),
accepted_queue_ms_(kDefaultAcceptedQueueMs) {
RTC_DCHECK(config.constraints.at_time.IsFinite());
ParseFieldTrial(
{&safe_reset_on_route_change_, &safe_reset_acknowledged_rate_},
field_trial::FindFullName("WebRTC-Bwe-SafeResetOnRouteChange"));
delay_based_bwe_->SetMinBitrate(congestion_controller::GetMinBitrateBps());
if (in_cwnd_experiment_ &&
!ReadCwndExperimentParameter(&accepted_queue_ms_)) {
@ -183,14 +187,22 @@ NetworkControlUpdate GoogCcNetworkController::OnNetworkRouteChange(
ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps);
if (safe_reset_on_route_change_) {
int32_t estimated_bitrate_bps;
uint8_t fraction_loss;
int64_t rtt_ms;
bandwidth_estimation_->CurrentEstimate(&estimated_bitrate_bps,
&fraction_loss, &rtt_ms);
if (!msg.constraints.starting_rate ||
estimated_bitrate_bps <= start_bitrate_bps) {
start_bitrate_bps = estimated_bitrate_bps;
absl::optional<uint32_t> estimated_bitrate_bps;
if (safe_reset_acknowledged_rate_) {
estimated_bitrate_bps = acknowledged_bitrate_estimator_->bitrate_bps();
if (!estimated_bitrate_bps)
estimated_bitrate_bps = acknowledged_bitrate_estimator_->PeekBps();
} else {
int32_t target_bitrate_bps;
uint8_t fraction_loss;
int64_t rtt_ms;
bandwidth_estimation_->CurrentEstimate(&target_bitrate_bps,
&fraction_loss, &rtt_ms);
estimated_bitrate_bps = target_bitrate_bps;
}
if (estimated_bitrate_bps && (!msg.constraints.starting_rate ||
estimated_bitrate_bps < start_bitrate_bps)) {
start_bitrate_bps = *estimated_bitrate_bps;
if (msg.constraints.starting_rate) {
msg.constraints.starting_rate = DataRate::bps(start_bitrate_bps);
}

View File

@ -64,7 +64,8 @@ class GoogCcNetworkController : public NetworkControllerInterface {
RtcEventLog* const event_log_;
const bool packet_feedback_only_;
const bool safe_reset_on_route_change_;
FieldTrialFlag safe_reset_on_route_change_;
FieldTrialFlag safe_reset_acknowledged_rate_;
const std::unique_ptr<ProbeController> probe_controller_;
const std::unique_ptr<CongestionWindowPushbackController>