Adds allocated rate without feedback to new congestion controller.

When bitrate is allocated to streams that does not have packet feedback,
the allocated bitrate should be included in the estimate. This was
previously only implemented for the old congestion controller and not
for the new task queue based version.

To make the behavior more robust, the responsibility for tracking this
is moved to BitrateAllocator where it's handled consistently for
multiple streams without feedback.

Bug: webrtc:9586, webrtc:8243
Change-Id: I8af7fec23e1bdc08cc61cf1b4ff10461c3711fb0
Reviewed-on: https://webrtc-review.googlesource.com/102681
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24905}
This commit is contained in:
Sebastian Jansson 2018-10-01 09:16:12 +02:00 committed by Commit Bot
parent e0d455b409
commit 35fa280229
12 changed files with 49 additions and 15 deletions

View File

@ -36,6 +36,8 @@ struct StreamsConfig {
absl::optional<DataRate> min_pacing_rate;
absl::optional<DataRate> max_padding_rate;
absl::optional<DataRate> max_total_allocated_bitrate;
// The send rate of traffic for which feedback is not received.
DataRate unacknowledged_rate_allocation = DataRate::Zero();
};
struct TargetRateConstraints {

View File

@ -410,12 +410,6 @@ uint32_t AudioSendStream::OnBitrateUpdated(uint32_t bitrate_bps,
uint8_t fraction_loss,
int64_t rtt,
int64_t bwe_period_ms) {
// Audio transport feedback will not be reported in this mode, instead update
// acknowledged bitrate estimator with the bitrate allocated for audio.
if (webrtc::field_trial::IsEnabled("WebRTC-Audio-ABWENoTWCC")) {
transport_->SetAllocatedBitrateWithoutFeedback(bitrate_bps);
}
// A send stream may be allocated a bitrate of zero if the allocator decides
// to disable it. For now we ignore this decision and keep sending on min
// bitrate.

View File

@ -75,10 +75,11 @@ const AudioCodecSpec kCodecSpecs[] = {
class MockLimitObserver : public BitrateAllocator::LimitObserver {
public:
MOCK_METHOD4(OnAllocationLimitsChanged,
MOCK_METHOD5(OnAllocationLimitsChanged,
void(uint32_t min_send_bitrate_bps,
uint32_t max_padding_bitrate_bps,
uint32_t total_bitrate_bps,
uint32_t allocated_without_feedback_bps,
bool has_packet_feedback));
};

View File

@ -60,6 +60,7 @@ BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer)
total_requested_padding_bitrate_(0),
total_requested_min_bitrate_(0),
total_requested_max_bitrate_(0),
allocated_without_feedback_(0),
has_packet_feedback_(false),
bitrate_allocation_strategy_(nullptr),
transmission_max_bitrate_multiplier_(
@ -191,6 +192,7 @@ void BitrateAllocator::UpdateAllocationLimits() {
uint32_t total_requested_min_bitrate = 0;
uint32_t total_requested_max_bitrate = 0;
bool has_packet_feedback = false;
uint32_t allocated_without_feedback = 0;
for (const auto& config : bitrate_observer_configs_) {
uint32_t stream_padding = config.pad_up_bitrate_bps;
if (config.enforce_min_bitrate) {
@ -203,11 +205,16 @@ void BitrateAllocator::UpdateAllocationLimits() {
total_requested_max_bitrate += config.max_bitrate_bps;
if (config.allocated_bitrate_bps > 0 && config.has_packet_feedback)
has_packet_feedback = true;
// TODO(srte): Remove field trial check.
if (!config.has_packet_feedback &&
field_trial::IsEnabled("WebRTC-Audio-ABWENoTWCC"))
allocated_without_feedback += config.allocated_bitrate_bps;
}
if (total_requested_padding_bitrate == total_requested_padding_bitrate_ &&
total_requested_min_bitrate == total_requested_min_bitrate_ &&
total_requested_max_bitrate == total_requested_max_bitrate_ &&
allocated_without_feedback == allocated_without_feedback_ &&
has_packet_feedback == has_packet_feedback_) {
return;
}
@ -215,6 +222,7 @@ void BitrateAllocator::UpdateAllocationLimits() {
total_requested_min_bitrate_ = total_requested_min_bitrate;
total_requested_padding_bitrate_ = total_requested_padding_bitrate;
total_requested_max_bitrate_ = total_requested_max_bitrate;
allocated_without_feedback_ = allocated_without_feedback;
has_packet_feedback_ = has_packet_feedback;
RTC_LOG(LS_INFO) << "UpdateAllocationLimits : total_requested_min_bitrate: "
@ -225,7 +233,8 @@ void BitrateAllocator::UpdateAllocationLimits() {
<< total_requested_max_bitrate << "bps";
limit_observer_->OnAllocationLimitsChanged(
total_requested_min_bitrate, total_requested_padding_bitrate,
total_requested_max_bitrate, has_packet_feedback);
total_requested_max_bitrate, allocated_without_feedback,
has_packet_feedback);
}
void BitrateAllocator::RemoveObserver(BitrateAllocatorObserver* observer) {

View File

@ -88,10 +88,12 @@ class BitrateAllocator : public BitrateAllocatorInterface {
// bitrate and max padding bitrate is changed.
class LimitObserver {
public:
virtual void OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
uint32_t max_padding_bitrate_bps,
uint32_t total_bitrate_bps,
bool has_packet_feedback) = 0;
virtual void OnAllocationLimitsChanged(
uint32_t min_send_bitrate_bps,
uint32_t max_padding_bitrate_bps,
uint32_t total_bitrate_bps,
uint32_t allocated_without_feedback_bps,
bool has_packet_feedback) = 0;
protected:
virtual ~LimitObserver() = default;
@ -242,6 +244,7 @@ class BitrateAllocator : public BitrateAllocatorInterface {
uint32_t total_requested_padding_bitrate_ RTC_GUARDED_BY(&sequenced_checker_);
uint32_t total_requested_min_bitrate_ RTC_GUARDED_BY(&sequenced_checker_);
uint32_t total_requested_max_bitrate_ RTC_GUARDED_BY(&sequenced_checker_);
uint32_t allocated_without_feedback_ RTC_GUARDED_BY(&sequenced_checker_);
bool has_packet_feedback_ RTC_GUARDED_BY(&sequenced_checker_);
std::unique_ptr<rtc::BitrateAllocationStrategy> bitrate_allocation_strategy_
RTC_GUARDED_BY(&sequenced_checker_);

View File

@ -28,6 +28,7 @@ class LimitObserverWrapper : public BitrateAllocator::LimitObserver {
void OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
uint32_t max_padding_bitrate_bps,
uint32_t total_bitrate_bps,
uint32_t allocated_without_feedback_bps,
bool has_packet_feedback) override {
OnAllocationLimitsChanged(min_send_bitrate_bps, max_padding_bitrate_bps,
total_bitrate_bps);

View File

@ -233,6 +233,7 @@ class Call final : public webrtc::Call,
void OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
uint32_t max_padding_bitrate_bps,
uint32_t total_bitrate_bps,
uint32_t allocated_without_feedback_bps,
bool has_packet_feedback) override;
private:
@ -1107,10 +1108,14 @@ void Call::OnTargetTransferRate(TargetTransferRate msg) {
void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
uint32_t max_padding_bitrate_bps,
uint32_t total_bitrate_bps,
uint32_t allocated_without_feedback_bps,
bool has_packet_feedback) {
transport_send_ptr_->SetAllocatedSendBitrateLimits(
min_send_bitrate_bps, max_padding_bitrate_bps, total_bitrate_bps);
transport_send_ptr_->SetPerPacketFeedbackAvailable(has_packet_feedback);
transport_send_ptr_->SetAllocatedBitrateWithoutFeedback(
allocated_without_feedback_bps);
rtc::CritScope lock(&bitrate_crit_);
min_allocated_send_bitrate_bps_ = min_send_bitrate_bps;
configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps;

View File

@ -307,6 +307,12 @@ void RtpTransportControllerSend::SetClientBitratePreferences(
void RtpTransportControllerSend::SetAllocatedBitrateWithoutFeedback(
uint32_t bitrate_bps) {
send_side_cc_->SetAllocatedBitrateWithoutFeedback(bitrate_bps);
// Audio transport feedback will not be reported in this mode, instead update
// acknowledged bitrate estimator with the bitrate allocated for audio.
if (field_trial::IsEnabled("WebRTC-Audio-ABWENoTWCC")) {
// TODO(srte): Make sure it's safe to always report this and remove the
// field trial check.
send_side_cc_->SetAllocatedBitrateWithoutFeedback(bitrate_bps);
}
}
} // namespace webrtc

View File

@ -323,6 +323,8 @@ NetworkControlUpdate BbrNetworkController::OnProcessInterval(
}
NetworkControlUpdate BbrNetworkController::OnStreamsConfig(StreamsConfig msg) {
// TODO(srte): Handle unacknowledged rate allocation.
RTC_DCHECK(msg.unacknowledged_rate_allocation.IsZero());
return NetworkControlUpdate();
}

View File

@ -294,6 +294,9 @@ NetworkControlUpdate GoogCcNetworkController::OnStreamsConfig(
max_padding_rate_ = *msg.max_padding_rate;
pacing_changed = true;
}
acknowledged_bitrate_estimator_->SetAllocatedBitrateWithoutFeedback(
msg.unacknowledged_rate_allocation.bps());
if (pacing_changed)
update.pacer_config = GetPacingRates(msg.at_time);
return update;

View File

@ -368,7 +368,9 @@ NetworkControlUpdate PccNetworkController::OnTransportLossReport(
return NetworkControlUpdate();
}
NetworkControlUpdate PccNetworkController::OnStreamsConfig(StreamsConfig) {
NetworkControlUpdate PccNetworkController::OnStreamsConfig(StreamsConfig msg) {
// TODO(srte): Handle unacknowledged rate allocation.
RTC_DCHECK(msg.unacknowledged_rate_allocation.IsZero());
return NetworkControlUpdate();
}

View File

@ -752,7 +752,13 @@ void SendSideCongestionController::SetPacingFactor(float pacing_factor) {
}
void SendSideCongestionController::SetAllocatedBitrateWithoutFeedback(
uint32_t bitrate_bps) {}
uint32_t bitrate_bps) {
task_queue_->PostTask([this, bitrate_bps]() {
RTC_DCHECK_RUN_ON(task_queue_);
streams_config_.unacknowledged_rate_allocation = DataRate::bps(bitrate_bps);
UpdateStreamsConfig();
});
}
void SendSideCongestionController::DisablePeriodicTasks() {
task_queue_->PostTask([this]() {