Moving SetPacingFactor and allocation limits to SSCC.

This CL adds methods to the SendSideCongestionController (SSCC)
interface for configuring pacing factor and allocation based data rate limits.
This means that old SSCC implement the same interface as the new, task
queue based SSCC. This also allows merging the max total allocated
bit rate into SetAllocatedSendBitrateLimits.

This is done in preparation for an upcoming CL where the SSCC version
is controlled by a field trial.

Bug: webrtc:8415
Change-Id: I4d5446a3bedd5b0c725dbd009fb75815fd661eff
Reviewed-on: https://webrtc-review.googlesource.com/61320
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22408}
This commit is contained in:
Sebastian Jansson 2018-03-13 11:40:34 +01:00 committed by Commit Bot
parent ca8438b6bd
commit 68ee4653ef
6 changed files with 35 additions and 35 deletions

View File

@ -91,8 +91,8 @@ void RtpTransportControllerSend::SetAllocatedSendBitrateLimits(
int min_send_bitrate_bps,
int max_padding_bitrate_bps,
int max_total_bitrate_bps) {
pacer_.SetSendBitrateLimits(min_send_bitrate_bps, max_padding_bitrate_bps);
send_side_cc_->SetMaxTotalAllocatedBitrate(max_total_bitrate_bps);
send_side_cc_->SetAllocatedSendBitrateLimits(
min_send_bitrate_bps, max_padding_bitrate_bps, max_total_bitrate_bps);
}
void RtpTransportControllerSend::SetKeepAliveConfig(
@ -100,7 +100,7 @@ void RtpTransportControllerSend::SetKeepAliveConfig(
keepalive_ = config;
}
void RtpTransportControllerSend::SetPacingFactor(float pacing_factor) {
pacer_.SetPacingFactor(pacing_factor);
send_side_cc_->SetPacingFactor(pacing_factor);
}
void RtpTransportControllerSend::SetQueueTimeLimit(int limit_ms) {
pacer_.SetQueueTimeLimit(limit_ms);

View File

@ -68,7 +68,9 @@ class SendSideCongestionController
int start_bitrate_bps,
int max_bitrate_bps) override;
void SetMaxTotalAllocatedBitrate(int max_total_allocated_bitrate) override;
void SetAllocatedSendBitrateLimits(int64_t min_send_bitrate_bps,
int64_t max_padding_bitrate_bps,
int64_t max_total_bitrate_bps) override;
// Resets the BWE state. Note the first argument is the bitrate_bps.
void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route,
@ -114,6 +116,8 @@ class SendSideCongestionController
std::vector<PacketFeedback> GetTransportFeedbackVector() const;
void SetPacingFactor(float pacing_factor) override;
private:
void MaybeTriggerOnNetworkChanged();

View File

@ -49,7 +49,9 @@ class SendSideCongestionControllerInterface : public CallStatsObserver,
virtual void SetBweBitrates(int min_bitrate_bps,
int start_bitrate_bps,
int max_bitrate_bps) = 0;
virtual void SetMaxTotalAllocatedBitrate(int total_bitrate_bps) = 0;
virtual void SetAllocatedSendBitrateLimits(int64_t min_send_bitrate_bps,
int64_t max_padding_bitrate_bps,
int64_t max_total_bitrate_bps) = 0;
virtual void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route,
int bitrate_bps,
int min_bitrate_bps,
@ -62,6 +64,7 @@ class SendSideCongestionControllerInterface : public CallStatsObserver,
virtual TransportFeedbackObserver* GetTransportFeedbackObserver() = 0;
virtual void EnablePeriodicAlrProbing(bool enable) = 0;
virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
virtual void SetPacingFactor(float pacing_factor) = 0;
RTC_DISALLOW_COPY_AND_ASSIGN(SendSideCongestionControllerInterface);
};

View File

@ -83,7 +83,9 @@ class SendSideCongestionController
int start_bitrate_bps,
int max_bitrate_bps) override;
void SetMaxTotalAllocatedBitrate(int max_total_allocated_bitrate) override;
void SetAllocatedSendBitrateLimits(int64_t min_send_bitrate_bps,
int64_t max_padding_bitrate_bps,
int64_t max_total_bitrate_bps) override;
// Resets the BWE state. Note the first argument is the bitrate_bps.
void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route,
@ -125,16 +127,7 @@ class SendSideCongestionController
std::vector<PacketFeedback> GetTransportFeedbackVector() const;
// Sets the minimum send bitrate and maximum padding bitrate requested by send
// streams.
// |min_send_bitrate_bps| might be higher that the estimated available network
// bitrate and if so, the pacer will send with |min_send_bitrate_bps|.
// |max_padding_bitrate_bps| might be higher than the estimate available
// network bitrate and if so, the pacer will send padding packets to reach
// the min of the estimated available bitrate and |max_padding_bitrate_bps|.
void SetSendBitrateLimits(int64_t min_send_bitrate_bps,
int64_t max_padding_bitrate_bps);
void SetPacingFactor(float pacing_factor);
void SetPacingFactor(float pacing_factor) override;
protected:
// TODO(srte): The tests should be rewritten to not depend on internals and

View File

@ -359,12 +359,17 @@ void SendSideCongestionController::SetBweBitrates(int min_bitrate_bps,
});
}
void SendSideCongestionController::SetMaxTotalAllocatedBitrate(
int max_total_allocated_bitrate) {
task_queue_->PostTask([this, max_total_allocated_bitrate]() {
void SendSideCongestionController::SetAllocatedSendBitrateLimits(
int64_t min_send_bitrate_bps,
int64_t max_padding_bitrate_bps,
int64_t max_total_bitrate_bps) {
task_queue_->PostTask([this, min_send_bitrate_bps, max_padding_bitrate_bps,
max_total_bitrate_bps]() {
RTC_DCHECK_RUN_ON(task_queue_.get());
streams_config_.min_pacing_rate = DataRate::bps(min_send_bitrate_bps);
streams_config_.max_padding_rate = DataRate::bps(max_padding_bitrate_bps);
streams_config_.max_total_allocated_bitrate =
DataRate::bps(max_total_allocated_bitrate);
DataRate::bps(max_total_bitrate_bps);
UpdateStreamsConfig();
});
}
@ -605,18 +610,6 @@ void SendSideCongestionController::WaitOnTasksForTest() {
event.Wait(rtc::Event::kForever);
}
void SendSideCongestionController::SetSendBitrateLimits(
int64_t min_send_bitrate_bps,
int64_t max_padding_bitrate_bps) {
task_queue_->PostTask([this, min_send_bitrate_bps,
max_padding_bitrate_bps]() {
RTC_DCHECK_RUN_ON(task_queue_.get());
streams_config_.min_pacing_rate = DataRate::bps(min_send_bitrate_bps);
streams_config_.max_padding_rate = DataRate::bps(max_padding_bitrate_bps);
UpdateStreamsConfig();
});
}
void SendSideCongestionController::SetPacingFactor(float pacing_factor) {
task_queue_->PostTask([this, pacing_factor]() {
RTC_DCHECK_RUN_ON(task_queue_.get());

View File

@ -190,9 +190,12 @@ void SendSideCongestionController::SetBweBitrates(int min_bitrate_bps,
MaybeTriggerOnNetworkChanged();
}
void SendSideCongestionController::SetMaxTotalAllocatedBitrate(
int total_bitrate_bps) {
probe_controller_->OnMaxTotalAllocatedBitrate(total_bitrate_bps);
void SendSideCongestionController::SetAllocatedSendBitrateLimits(
int64_t min_send_bitrate_bps,
int64_t max_padding_bitrate_bps,
int64_t max_total_bitrate_bps) {
pacer_->SetSendBitrateLimits(min_send_bitrate_bps, max_padding_bitrate_bps);
probe_controller_->OnMaxTotalAllocatedBitrate(max_total_bitrate_bps);
}
// TODO(holmer): Split this up and use SetBweBitrates in combination with
@ -404,6 +407,10 @@ SendSideCongestionController::GetTransportFeedbackVector() const {
return transport_feedback_adapter_.GetTransportFeedbackVector();
}
void SendSideCongestionController::SetPacingFactor(float pacing_factor) {
pacer_->SetPacingFactor(pacing_factor);
}
void SendSideCongestionController::MaybeTriggerOnNetworkChanged() {
uint32_t bitrate_bps;
uint8_t fraction_loss;