Refactor some config plumbing in call/.

Address perkj's comments left in
https://webrtc-review.googlesource.com/c/src/+/283420. I was a bit
trigger-happy with the submit button.

Bug: chromium:1354491
Change-Id: Ifd052f75af3763b0b52807c31ea790e3efee921d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283521
Reviewed-by: Erik Språng <sprang@webrtc.org>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38638}
This commit is contained in:
Henrik Boström 2022-11-15 15:45:41 +01:00 committed by WebRTC LUCI CQ
parent e085366aca
commit da4c102cbd
7 changed files with 48 additions and 60 deletions

View file

@ -84,55 +84,55 @@ RtpTransportControllerSend::PacerSettings::PacerSettings(
RtpTransportControllerSend::RtpTransportControllerSend( RtpTransportControllerSend::RtpTransportControllerSend(
Clock* clock, Clock* clock,
webrtc::RtcEventLog* event_log, const RtpTransportConfig& config)
NetworkStatePredictorFactoryInterface* predictor_factory,
NetworkControllerFactoryInterface* controller_factory,
const BitrateConstraints& bitrate_config,
TaskQueueFactory* task_queue_factory,
const FieldTrialsView& trials,
absl::optional<TimeDelta> pacer_burst_interval)
: clock_(clock), : clock_(clock),
event_log_(event_log), event_log_(config.event_log),
task_queue_factory_(task_queue_factory), task_queue_factory_(config.task_queue_factory),
bitrate_configurator_(bitrate_config), bitrate_configurator_(config.bitrate_config),
pacer_started_(false), pacer_started_(false),
pacer_settings_(trials), pacer_settings_(*config.trials),
pacer_(clock, pacer_(clock,
&packet_router_, &packet_router_,
trials, *config.trials,
task_queue_factory, config.task_queue_factory,
pacer_settings_.holdback_window.Get(), pacer_settings_.holdback_window.Get(),
pacer_settings_.holdback_packets.Get(), pacer_settings_.holdback_packets.Get(),
pacer_burst_interval), config.pacer_burst_interval),
observer_(nullptr), observer_(nullptr),
controller_factory_override_(controller_factory), controller_factory_override_(config.network_controller_factory),
controller_factory_fallback_( controller_factory_fallback_(
std::make_unique<GoogCcNetworkControllerFactory>(predictor_factory)), std::make_unique<GoogCcNetworkControllerFactory>(
config.network_state_predictor_factory)),
process_interval_(controller_factory_fallback_->GetProcessInterval()), process_interval_(controller_factory_fallback_->GetProcessInterval()),
last_report_block_time_(Timestamp::Millis(clock_->TimeInMilliseconds())), last_report_block_time_(Timestamp::Millis(clock_->TimeInMilliseconds())),
reset_feedback_on_route_change_( reset_feedback_on_route_change_(
!IsEnabled(trials, "WebRTC-Bwe-NoFeedbackReset")), !IsEnabled(*config.trials, "WebRTC-Bwe-NoFeedbackReset")),
send_side_bwe_with_overhead_( send_side_bwe_with_overhead_(
!IsDisabled(trials, "WebRTC-SendSideBwe-WithOverhead")), !IsDisabled(*config.trials, "WebRTC-SendSideBwe-WithOverhead")),
add_pacing_to_cwin_( add_pacing_to_cwin_(
IsEnabled(trials, "WebRTC-AddPacingToCongestionWindowPushback")), IsEnabled(*config.trials,
"WebRTC-AddPacingToCongestionWindowPushback")),
relay_bandwidth_cap_("relay_cap", DataRate::PlusInfinity()), relay_bandwidth_cap_("relay_cap", DataRate::PlusInfinity()),
transport_overhead_bytes_per_packet_(0), transport_overhead_bytes_per_packet_(0),
network_available_(false), network_available_(false),
congestion_window_size_(DataSize::PlusInfinity()), congestion_window_size_(DataSize::PlusInfinity()),
is_congested_(false), is_congested_(false),
retransmission_rate_limiter_(clock, kRetransmitWindowSizeMs), retransmission_rate_limiter_(clock, kRetransmitWindowSizeMs),
task_queue_(trials, "rtp_send_controller", task_queue_factory), task_queue_(*config.trials,
field_trials_(trials) { "rtp_send_controller",
config.task_queue_factory),
field_trials_(*config.trials) {
ParseFieldTrial({&relay_bandwidth_cap_}, ParseFieldTrial({&relay_bandwidth_cap_},
trials.Lookup("WebRTC-Bwe-NetworkRouteConstraints")); config.trials->Lookup("WebRTC-Bwe-NetworkRouteConstraints"));
initial_config_.constraints = ConvertConstraints(bitrate_config, clock_); initial_config_.constraints =
initial_config_.event_log = event_log; ConvertConstraints(config.bitrate_config, clock_);
initial_config_.key_value_config = &trials; initial_config_.event_log = config.event_log;
RTC_DCHECK(bitrate_config.start_bitrate_bps > 0); initial_config_.key_value_config = config.trials;
RTC_DCHECK(config.bitrate_config.start_bitrate_bps > 0);
pacer_.SetPacingRates(DataRate::BitsPerSec(bitrate_config.start_bitrate_bps), pacer_.SetPacingRates(
DataRate::Zero()); DataRate::BitsPerSec(config.bitrate_config.start_bitrate_bps),
DataRate::Zero());
} }
RtpTransportControllerSend::~RtpTransportControllerSend() { RtpTransportControllerSend::~RtpTransportControllerSend() {

View file

@ -25,6 +25,7 @@
#include "api/transport/network_control.h" #include "api/transport/network_control.h"
#include "api/units/data_rate.h" #include "api/units/data_rate.h"
#include "call/rtp_bitrate_configurator.h" #include "call/rtp_bitrate_configurator.h"
#include "call/rtp_transport_config.h"
#include "call/rtp_transport_controller_send_interface.h" #include "call/rtp_transport_controller_send_interface.h"
#include "call/rtp_video_sender.h" #include "call/rtp_video_sender.h"
#include "modules/congestion_controller/rtp/control_handler.h" #include "modules/congestion_controller/rtp/control_handler.h"
@ -50,15 +51,7 @@ class RtpTransportControllerSend final
public TransportFeedbackObserver, public TransportFeedbackObserver,
public NetworkStateEstimateObserver { public NetworkStateEstimateObserver {
public: public:
RtpTransportControllerSend( RtpTransportControllerSend(Clock* clock, const RtpTransportConfig& config);
Clock* clock,
RtcEventLog* event_log,
NetworkStatePredictorFactoryInterface* predictor_factory,
NetworkControllerFactoryInterface* controller_factory,
const BitrateConstraints& bitrate_config,
TaskQueueFactory* task_queue_factory,
const FieldTrialsView& trials,
absl::optional<TimeDelta> pacer_burst_interval);
~RtpTransportControllerSend() override; ~RtpTransportControllerSend() override;
RtpTransportControllerSend(const RtpTransportControllerSend&) = delete; RtpTransportControllerSend(const RtpTransportControllerSend&) = delete;

View file

@ -25,10 +25,7 @@ class RtpTransportControllerSendFactory
const RtpTransportConfig& config, const RtpTransportConfig& config,
Clock* clock) override { Clock* clock) override {
RTC_CHECK(config.trials); RTC_CHECK(config.trials);
return std::make_unique<RtpTransportControllerSend>( return std::make_unique<RtpTransportControllerSend>(clock, config);
clock, config.event_log, config.network_state_predictor_factory,
config.network_controller_factory, config.bitrate_config,
config.task_queue_factory, *config.trials, config.pacer_burst_interval);
} }
virtual ~RtpTransportControllerSendFactory() {} virtual ~RtpTransportControllerSendFactory() {}

View file

@ -129,14 +129,14 @@ class RtpVideoSenderTestFixture {
payload_type)), payload_type)),
send_delay_stats_(time_controller_.GetClock()), send_delay_stats_(time_controller_.GetClock()),
bitrate_config_(GetBitrateConfig()), bitrate_config_(GetBitrateConfig()),
transport_controller_(time_controller_.GetClock(), transport_controller_(
&event_log_, time_controller_.GetClock(),
nullptr, RtpTransportConfig{
nullptr, .bitrate_config = bitrate_config_,
bitrate_config_, .event_log = &event_log_,
time_controller_.GetTaskQueueFactory(), .task_queue_factory = time_controller_.GetTaskQueueFactory(),
field_trials ? *field_trials : field_trials_, .trials = field_trials ? field_trials : &field_trials_,
absl::nullopt), }),
stats_proxy_(time_controller_.GetClock(), stats_proxy_(time_controller_.GetClock(),
config_, config_,
VideoEncoderConfig::ContentType::kRealtimeVideo, VideoEncoderConfig::ContentType::kRealtimeVideo,

View file

@ -86,12 +86,11 @@ TaskQueuePacedSender::TaskQueuePacedSender(
burst = slacked_burst; burst = slacked_burst;
} }
} }
// Burst can also be controlled via the `burst_interval` argument. // If not overriden by an experiment, the burst is specified by the
if (burst_interval.has_value() && // `burst_interval` argument.
(!burst.has_value() || burst.value() < burst_interval.value())) { if (!burst.has_value()) {
burst = burst_interval; burst = burst_interval;
} }
if (burst.has_value()) { if (burst.has_value()) {
pacing_controller_.SetSendBurstInterval(burst.value()); pacing_controller_.SetSendBurstInterval(burst.value());
} }

View file

@ -242,10 +242,9 @@ PeerConnectionFactory::CreatePeerConnectionOrError(
const FieldTrialsView* trials = const FieldTrialsView* trials =
dependencies.trials ? dependencies.trials.get() : &field_trials(); dependencies.trials ? dependencies.trials.get() : &field_trials();
std::unique_ptr<Call> call = worker_thread()->BlockingCall( std::unique_ptr<Call> call =
[this, &event_log, trials, worker_thread()->BlockingCall([this, &event_log, trials, &configuration] {
pacer_burst_interval = configuration.pacer_burst_interval] { return CreateCall_w(event_log.get(), *trials, configuration);
return CreateCall_w(event_log.get(), *trials, pacer_burst_interval);
}); });
auto result = PeerConnection::Create(context_, options_, std::move(event_log), auto result = PeerConnection::Create(context_, options_, std::move(event_log),
@ -305,7 +304,7 @@ std::unique_ptr<RtcEventLog> PeerConnectionFactory::CreateRtcEventLog_w() {
std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w( std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
RtcEventLog* event_log, RtcEventLog* event_log,
const FieldTrialsView& field_trials, const FieldTrialsView& field_trials,
absl::optional<TimeDelta> pacer_burst_interval) { const PeerConnectionInterface::RTCConfiguration& configuration) {
RTC_DCHECK_RUN_ON(worker_thread()); RTC_DCHECK_RUN_ON(worker_thread());
webrtc::Call::Config call_config(event_log, network_thread()); webrtc::Call::Config call_config(event_log, network_thread());
@ -348,7 +347,7 @@ std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
call_config.rtp_transport_controller_send_factory = call_config.rtp_transport_controller_send_factory =
transport_controller_send_factory_.get(); transport_controller_send_factory_.get();
call_config.metronome = metronome_.get(); call_config.metronome = metronome_.get();
call_config.pacer_burst_interval = pacer_burst_interval; call_config.pacer_burst_interval = configuration.pacer_burst_interval;
return std::unique_ptr<Call>( return std::unique_ptr<Call>(
context_->call_factory()->CreateCall(call_config)); context_->call_factory()->CreateCall(call_config));
} }

View file

@ -139,7 +139,7 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
std::unique_ptr<Call> CreateCall_w( std::unique_ptr<Call> CreateCall_w(
RtcEventLog* event_log, RtcEventLog* event_log,
const FieldTrialsView& field_trials, const FieldTrialsView& field_trials,
absl::optional<TimeDelta> pacer_burst_interval); const PeerConnectionInterface::RTCConfiguration& configuration);
rtc::scoped_refptr<ConnectionContext> context_; rtc::scoped_refptr<ConnectionContext> context_;
PeerConnectionFactoryInterface::Options options_ PeerConnectionFactoryInterface::Options options_