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 9ab19ae447..efe4d2ff47 100644 --- a/modules/congestion_controller/rtp/include/send_side_congestion_controller.h +++ b/modules/congestion_controller/rtp/include/send_side_congestion_controller.h @@ -158,6 +158,8 @@ class SendSideCongestionController private: void MaybeCreateControllers() RTC_RUN_ON(task_queue_); void MaybeRecreateControllers() RTC_RUN_ON(task_queue_); + void UpdateInitialConstraints(TargetRateConstraints new_contraints) + RTC_RUN_ON(task_queue_); void StartProcessPeriodicTasks() RTC_RUN_ON(task_queue_); void UpdateControllerWithTimeInterval() RTC_RUN_ON(task_queue_); diff --git a/modules/congestion_controller/rtp/send_side_congestion_controller.cc b/modules/congestion_controller/rtp/send_side_congestion_controller.cc index 51803da3fb..6e6bf4dc7c 100644 --- a/modules/congestion_controller/rtp/send_side_congestion_controller.cc +++ b/modules/congestion_controller/rtp/send_side_congestion_controller.cc @@ -419,6 +419,14 @@ void SendSideCongestionController::MaybeRecreateControllers() { RTC_DCHECK(controller_); } +void SendSideCongestionController::UpdateInitialConstraints( + TargetRateConstraints new_contraints) { + if (!new_contraints.starting_rate) + new_contraints.starting_rate = initial_config_.constraints.starting_rate; + RTC_DCHECK(new_contraints.starting_rate); + initial_config_.constraints = new_contraints; +} + SendSideCongestionController::~SendSideCongestionController() = default; void SendSideCongestionController::RegisterPacketFeedbackObserver( @@ -452,7 +460,7 @@ void SendSideCongestionController::SetBweBitrates(int min_bitrate_bps, control_handler_->PostUpdates( controller_->OnTargetRateConstraints(constraints)); } else { - initial_config_.constraints = constraints; + UpdateInitialConstraints(constraints); } }); } @@ -490,7 +498,7 @@ void SendSideCongestionController::OnNetworkRouteChanged( if (controller_) { control_handler_->PostUpdates(controller_->OnNetworkRouteChange(msg)); } else { - initial_config_.constraints = msg.constraints; + UpdateInitialConstraints(msg.constraints); } pacer_controller_->OnNetworkRouteChange(msg); });