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}diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc
index 044497d..d45b1e3 100644
--- a/call/rtp_transport_controller_send.cc
+++ b/call/rtp_transport_controller_send.cc
@@ -91,8 +91,8 @@
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 @@
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);
diff --git a/modules/congestion_controller/include/send_side_congestion_controller.h b/modules/congestion_controller/include/send_side_congestion_controller.h
index 5720522..94e549e 100644
--- a/modules/congestion_controller/include/send_side_congestion_controller.h
+++ b/modules/congestion_controller/include/send_side_congestion_controller.h
@@ -68,7 +68,9 @@
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 @@
std::vector<PacketFeedback> GetTransportFeedbackVector() const;
+ void SetPacingFactor(float pacing_factor) override;
+
private:
void MaybeTriggerOnNetworkChanged();
diff --git a/modules/congestion_controller/include/send_side_congestion_controller_interface.h b/modules/congestion_controller/include/send_side_congestion_controller_interface.h
index 6ea0d06..3eb3dd8 100644
--- a/modules/congestion_controller/include/send_side_congestion_controller_interface.h
+++ b/modules/congestion_controller/include/send_side_congestion_controller_interface.h
@@ -49,7 +49,9 @@
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 @@
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);
};
diff --git a/modules/congestion_controller/rtp/include/send_side_congestion_controller.h b/modules/congestion_controller/rtp/include/send_side_congestion_controller.h
index 1bcc543..40512c8 100644
--- a/modules/congestion_controller/rtp/include/send_side_congestion_controller.h
+++ b/modules/congestion_controller/rtp/include/send_side_congestion_controller.h
@@ -83,7 +83,9 @@
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 @@
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
diff --git a/modules/congestion_controller/rtp/send_side_congestion_controller.cc b/modules/congestion_controller/rtp/send_side_congestion_controller.cc
index 6b69c9c..606d3ba 100644
--- a/modules/congestion_controller/rtp/send_side_congestion_controller.cc
+++ b/modules/congestion_controller/rtp/send_side_congestion_controller.cc
@@ -359,12 +359,17 @@
});
}
-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 @@
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());
diff --git a/modules/congestion_controller/send_side_congestion_controller.cc b/modules/congestion_controller/send_side_congestion_controller.cc
index 33bd60e..fc316f8 100644
--- a/modules/congestion_controller/send_side_congestion_controller.cc
+++ b/modules/congestion_controller/send_side_congestion_controller.cc
@@ -190,9 +190,12 @@
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 @@
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;