Allows injection of network controller factory into peer connection factory.

Bug: webrtc:9155
Change-Id: I0a17024042f154297aba20f5d2dc766feb27f3f7
Reviewed-on: https://webrtc-review.googlesource.com/73123
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23313}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index effdb5d..f8b282f 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -108,6 +108,7 @@
     "audio:audio_mixer_api",
     "audio_codecs:audio_codecs_api",
     "transport:bitrate_settings",
+    "transport:network_control",
     "video:video_frame",
 
     # Basically, don't add stuff here. You might break sensitive downstream
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
index 7ec8353..8c06029 100644
--- a/api/peerconnectioninterface.h
+++ b/api/peerconnectioninterface.h
@@ -91,6 +91,7 @@
 #include "api/stats/rtcstatscollectorcallback.h"
 #include "api/statstypes.h"
 #include "api/transport/bitrate_settings.h"
+#include "api/transport/network_control.h"
 #include "api/turncustomizer.h"
 #include "api/umametrics.h"
 #include "logging/rtc_event_log/rtc_event_log_factory_interface.h"
@@ -1424,6 +1425,8 @@
 // created and used.
 // If |fec_controller_factory| is null, an internal fec controller module will
 // be created and used.
+// If |network_controller_factory| is provided, it will be used if enabled via
+// field trial.
 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
     rtc::Thread* network_thread,
     rtc::Thread* worker_thread,
@@ -1435,7 +1438,9 @@
     cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
     rtc::scoped_refptr<AudioMixer> audio_mixer,
     rtc::scoped_refptr<AudioProcessing> audio_processing,
-    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory);
+    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
+    std::unique_ptr<NetworkControllerFactoryInterface>
+        network_controller_factory = nullptr);
 
 // Create a new instance of PeerConnectionFactoryInterface with optional video
 // codec factories. These video factories represents all video codecs, i.e. no
@@ -1536,7 +1541,9 @@
     std::unique_ptr<cricket::MediaEngineInterface> media_engine,
     std::unique_ptr<CallFactoryInterface> call_factory,
     std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory,
-    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory);
+    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
+    std::unique_ptr<NetworkControllerFactoryInterface>
+        network_controller_factory = nullptr);
 
 }  // namespace webrtc
 
diff --git a/call/BUILD.gn b/call/BUILD.gn
index c509ace..d994edd 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -37,6 +37,7 @@
     "../api:transport_api",
     "../api/audio:audio_mixer_api",
     "../api/audio_codecs:audio_codecs_api",
+    "../api/transport:network_control",
     "../modules/audio_device:audio_device",
     "../modules/audio_processing:audio_processing",
     "../modules/audio_processing:audio_processing_statistics",
diff --git a/call/call.cc b/call/call.cc
index 3635bf2..25f1cd9 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -396,9 +396,9 @@
 
 Call* Call::Create(const Call::Config& config) {
   return new internal::Call(
-      config,
-      rtc::MakeUnique<RtpTransportControllerSend>(
-          Clock::GetRealTimeClock(), config.event_log, config.bitrate_config));
+      config, rtc::MakeUnique<RtpTransportControllerSend>(
+                  Clock::GetRealTimeClock(), config.event_log,
+                  config.network_controller_factory, config.bitrate_config));
 }
 
 Call* Call::Create(
diff --git a/call/call_config.h b/call/call_config.h
index 421b524..927ad75 100644
--- a/call/call_config.h
+++ b/call/call_config.h
@@ -12,6 +12,7 @@
 
 #include "api/fec_controller.h"
 #include "api/rtcerror.h"
+#include "api/transport/network_control.h"
 #include "call/audio_state.h"
 #include "call/bitrate_constraints.h"
 #include "rtc_base/platform_file.h"
@@ -45,6 +46,9 @@
 
   // FecController to use for this call.
   FecControllerFactoryInterface* fec_controller_factory = nullptr;
+
+  // Network controller factory to use for this call.
+  NetworkControllerFactoryInterface* network_controller_factory = nullptr;
 };
 
 }  // namespace webrtc
diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc
index 2a4a549..76ba7f6 100644
--- a/call/rtp_transport_controller_send.cc
+++ b/call/rtp_transport_controller_send.cc
@@ -33,12 +33,14 @@
     webrtc::RtcEventLog* event_log,
     PacedSender* pacer,
     const BitrateConstraints& bitrate_config,
-    bool task_queue_controller) {
+    bool task_queue_controller,
+    NetworkControllerFactoryInterface* controller_factory) {
   if (task_queue_controller) {
     RTC_LOG(LS_INFO) << "Using TaskQueue based SSCC";
     return rtc::MakeUnique<webrtc::webrtc_cc::SendSideCongestionController>(
         clock, task_queue, event_log, pacer, bitrate_config.start_bitrate_bps,
-        bitrate_config.min_bitrate_bps, bitrate_config.max_bitrate_bps);
+        bitrate_config.min_bitrate_bps, bitrate_config.max_bitrate_bps,
+        controller_factory);
   }
   RTC_LOG(LS_INFO) << "Using Legacy SSCC";
   auto cc = rtc::MakeUnique<webrtc::SendSideCongestionController>(
@@ -54,6 +56,7 @@
 RtpTransportControllerSend::RtpTransportControllerSend(
     Clock* clock,
     webrtc::RtcEventLog* event_log,
+    NetworkControllerFactoryInterface* controller_factory,
     const BitrateConstraints& bitrate_config)
     : clock_(clock),
       pacer_(clock, &packet_router_, event_log),
@@ -64,7 +67,7 @@
   // Created after task_queue to be able to post to the task queue internally.
   send_side_cc_ =
       CreateController(clock, &task_queue_, event_log, &pacer_, bitrate_config,
-                       TaskQueueExperimentEnabled());
+                       TaskQueueExperimentEnabled(), controller_factory);
 
   process_thread_->RegisterModule(&pacer_, RTC_FROM_HERE);
   process_thread_->RegisterModule(send_side_cc_.get(), RTC_FROM_HERE);
diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h
index 67248b2..25b1127 100644
--- a/call/rtp_transport_controller_send.h
+++ b/call/rtp_transport_controller_send.h
@@ -15,6 +15,7 @@
 #include <memory>
 #include <string>
 
+#include "api/transport/network_control.h"
 #include "call/rtp_bitrate_configurator.h"
 #include "call/rtp_transport_controller_send_interface.h"
 #include "common_types.h"  // NOLINT(build/include)
@@ -36,9 +37,11 @@
     : public RtpTransportControllerSendInterface,
       public NetworkChangedObserver {
  public:
-  RtpTransportControllerSend(Clock* clock,
-                             RtcEventLog* event_log,
-                             const BitrateConstraints& bitrate_config);
+  RtpTransportControllerSend(
+      Clock* clock,
+      RtcEventLog* event_log,
+      NetworkControllerFactoryInterface* controller_factory,
+      const BitrateConstraints& bitrate_config);
   ~RtpTransportControllerSend() override;
 
   // Implements NetworkChangedObserver interface.
diff --git a/modules/congestion_controller/bbr/bbr_network_controller.cc b/modules/congestion_controller/bbr/bbr_network_controller.cc
index 0a9a1f5..33ba015 100644
--- a/modules/congestion_controller/bbr/bbr_network_controller.cc
+++ b/modules/congestion_controller/bbr/bbr_network_controller.cc
@@ -177,6 +177,7 @@
       congestion_window_gain_constant_(kProbeBWCongestionWindowGain),
       rtt_variance_weight_(kBbrRttVariationWeight),
       recovery_window_(max_congestion_window_) {
+  RTC_LOG(LS_INFO) << "Creating BBR controller";
   config_ = BbrControllerConfig::ExperimentConfig();
   if (config.starting_bandwidth.IsFinite())
     default_bandwidth_ = config.starting_bandwidth;
diff --git a/modules/congestion_controller/rtp/BUILD.gn b/modules/congestion_controller/rtp/BUILD.gn
index 02c3245..3b36691 100644
--- a/modules/congestion_controller/rtp/BUILD.gn
+++ b/modules/congestion_controller/rtp/BUILD.gn
@@ -53,7 +53,6 @@
     "../../pacing",
     "../../remote_bitrate_estimator",
     "../../rtp_rtcp:rtp_rtcp_format",
-    "../bbr",
     "../goog_cc",
   ]
 
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 a273bbe..7d41e27 100644
--- a/modules/congestion_controller/rtp/include/send_side_congestion_controller.h
+++ b/modules/congestion_controller/rtp/include/send_side_congestion_controller.h
@@ -65,13 +65,16 @@
     : public SendSideCongestionControllerInterface,
       public RtcpBandwidthObserver {
  public:
-  SendSideCongestionController(const Clock* clock,
-                               rtc::TaskQueue* task_queue,
-                               RtcEventLog* event_log,
-                               PacedSender* pacer,
-                               int start_bitrate_bps,
-                               int min_bitrate_bps,
-                               int max_bitrate_bps);
+  SendSideCongestionController(
+      const Clock* clock,
+      rtc::TaskQueue* task_queue,
+      RtcEventLog* event_log,
+      PacedSender* pacer,
+      int start_bitrate_bps,
+      int min_bitrate_bps,
+      int max_bitrate_bps,
+      NetworkControllerFactoryInterface* controller_factory);
+
   ~SendSideCongestionController() override;
 
   void RegisterPacketFeedbackObserver(
@@ -170,8 +173,8 @@
   // TODO(srte): Move all access to feedback adapter to task queue.
   TransportFeedbackAdapter transport_feedback_adapter_;
 
-  const std::unique_ptr<NetworkControllerFactoryInterface>
-      controller_factory_with_feedback_ RTC_GUARDED_BY(task_queue_);
+  NetworkControllerFactoryInterface* const controller_factory_with_feedback_
+      RTC_GUARDED_BY(task_queue_);
   const std::unique_ptr<NetworkControllerFactoryInterface>
       controller_factory_fallback_ RTC_GUARDED_BY(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 6d3f301..00224bd 100644
--- a/modules/congestion_controller/rtp/send_side_congestion_controller.cc
+++ b/modules/congestion_controller/rtp/send_side_congestion_controller.cc
@@ -15,12 +15,10 @@
 #include <memory>
 #include <vector>
 #include "api/transport/network_types.h"
-#include "modules/congestion_controller/bbr/bbr_factory.h"
 #include "modules/congestion_controller/goog_cc/include/goog_cc_factory.h"
 #include "modules/remote_bitrate_estimator/include/bwe_defines.h"
 #include "rtc_base/bind.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/experiments/congestion_controller_experiment.h"
 #include "rtc_base/format_macros.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/numerics/safe_conversions.h"
@@ -50,16 +48,6 @@
               webrtc::runtime_enabled_features::kDualStreamModeFeatureName));
 }
 
-std::unique_ptr<NetworkControllerFactoryInterface> MaybeCreateBbrFactory() {
-  if (CongestionControllerExperiment::BbrControllerEnabled()) {
-    RTC_LOG(LS_INFO) << "Creating BBR factory";
-    return rtc::MakeUnique<BbrNetworkControllerFactory>();
-  } else {
-    RTC_LOG(LS_INFO) << "Not creating BBR factory";
-    return nullptr;
-  }
-}
-
 void SortPacketFeedbackVector(std::vector<webrtc::PacketFeedback>* input) {
   std::sort(input->begin(), input->end(), PacketFeedbackComparator());
 }
@@ -310,11 +298,12 @@
     PacedSender* pacer,
     int start_bitrate_bps,
     int min_bitrate_bps,
-    int max_bitrate_bps)
+    int max_bitrate_bps,
+    NetworkControllerFactoryInterface* controller_factory)
     : clock_(clock),
       pacer_(pacer),
       transport_feedback_adapter_(clock_),
-      controller_factory_with_feedback_(MaybeCreateBbrFactory()),
+      controller_factory_with_feedback_(controller_factory),
       controller_factory_fallback_(
           rtc::MakeUnique<GoogCcNetworkControllerFactory>(event_log)),
       pacer_controller_(MakeUnique<PacerController>(pacer_)),
diff --git a/modules/congestion_controller/rtp/send_side_congestion_controller_unittest.cc b/modules/congestion_controller/rtp/send_side_congestion_controller_unittest.cc
index 0f59808..136a989 100644
--- a/modules/congestion_controller/rtp/send_side_congestion_controller_unittest.cc
+++ b/modules/congestion_controller/rtp/send_side_congestion_controller_unittest.cc
@@ -77,7 +77,7 @@
     task_queue_ = rtc::MakeUnique<rtc::TaskQueue>("SSCC Test");
     controller_.reset(new SendSideCongestionControllerForTest(
         &clock_, task_queue_.get(), &event_log_, pacer_.get(),
-        kInitialBitrateBps, 0, 5 * kInitialBitrateBps));
+        kInitialBitrateBps, 0, 5 * kInitialBitrateBps, nullptr));
     controller_->DisablePeriodicTasks();
     controller_->RegisterNetworkObserver(&observer_);
     controller_->SignalNetworkState(NetworkState::kNetworkUp);
@@ -97,7 +97,7 @@
     task_queue_ = rtc::MakeUnique<rtc::TaskQueue>("SSCC Test");
     controller_.reset(new SendSideCongestionControllerForTest(
         &clock_, task_queue_.get(), &event_log_, pacer_.get(),
-        kInitialBitrateBps, 0, 5 * kInitialBitrateBps));
+        kInitialBitrateBps, 0, 5 * kInitialBitrateBps, nullptr));
     controller_->DisablePeriodicTasks();
     controller_->RegisterNetworkObserver(&target_bitrate_observer_);
     controller_->SignalNetworkState(NetworkState::kNetworkUp);
diff --git a/ortc/rtptransportcontrolleradapter.cc b/ortc/rtptransportcontrolleradapter.cc
index f69edd5..5d5bf5e 100644
--- a/ortc/rtptransportcontrolleradapter.cc
+++ b/ortc/rtptransportcontrolleradapter.cc
@@ -657,7 +657,8 @@
   call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
   std::unique_ptr<RtpTransportControllerSend> controller_send =
       rtc::MakeUnique<RtpTransportControllerSend>(
-          Clock::GetRealTimeClock(), event_log_, call_config.bitrate_config);
+          Clock::GetRealTimeClock(), event_log_,
+          call_config.network_controller_factory, call_config.bitrate_config);
   call_send_rtp_transport_controller_ = controller_send.get();
   call_.reset(webrtc::Call::Create(call_config, std::move(controller_send)));
 }
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index 15e050b..2942d11 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -204,11 +204,13 @@
     "../logging:rtc_event_log_impl_output",
     "../media:rtc_data",
     "../media:rtc_media_base",
+    "../modules/congestion_controller/bbr",
     "../p2p:rtc_p2p",
     "../rtc_base:checks",
     "../rtc_base:rtc_base",
     "../rtc_base:rtc_base_approved",
     "../rtc_base:stringutils",
+    "../rtc_base/experiments:congestion_controller_experiment",
     "../stats",
     "../system_wrappers",
     "../system_wrappers:field_trial_api",
diff --git a/pc/DEPS b/pc/DEPS
index 38d40a0..1f9d152 100644
--- a/pc/DEPS
+++ b/pc/DEPS
@@ -8,6 +8,7 @@
   "+media",
   "+modules/audio_device",
   "+modules/audio_processing",
+  "+modules/congestion_controller",
   "+modules/rtp_rtcp",
   "+modules/video_coding",
   "+modules/video_render",
diff --git a/pc/createpeerconnectionfactory.cc b/pc/createpeerconnectionfactory.cc
index 72e5782..bbc4ebb 100644
--- a/pc/createpeerconnectionfactory.cc
+++ b/pc/createpeerconnectionfactory.cc
@@ -79,7 +79,9 @@
     cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
     rtc::scoped_refptr<AudioMixer> audio_mixer,
     rtc::scoped_refptr<AudioProcessing> audio_processing,
-    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory) {
+    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
+    std::unique_ptr<NetworkControllerFactoryInterface>
+        network_controller_factory) {
   rtc::scoped_refptr<AudioProcessing> audio_processing_use = audio_processing;
   if (!audio_processing_use) {
     audio_processing_use = AudioProcessingBuilder().Create();
@@ -99,7 +101,7 @@
   return CreateModularPeerConnectionFactory(
       network_thread, worker_thread, signaling_thread, std::move(media_engine),
       std::move(call_factory), std::move(event_log_factory),
-      std::move(fec_controller_factory));
+      std::move(fec_controller_factory), std::move(network_controller_factory));
 }
 #endif
 
diff --git a/pc/peerconnectionfactory.cc b/pc/peerconnectionfactory.cc
index 4889723..0fc6af2 100644
--- a/pc/peerconnectionfactory.cc
+++ b/pc/peerconnectionfactory.cc
@@ -34,6 +34,7 @@
 #include "media/engine/webrtcvideodecoderfactory.h"     // nogncheck
 #include "media/engine/webrtcvideoencoderfactory.h"     // nogncheck
 #include "modules/audio_device/include/audio_device.h"  // nogncheck
+#include "modules/congestion_controller/bbr/bbr_factory.h"
 #include "p2p/base/basicpacketsocketfactory.h"
 #include "p2p/client/basicportallocator.h"
 #include "pc/audiotrack.h"
@@ -42,6 +43,7 @@
 #include "pc/peerconnection.h"
 #include "pc/videocapturertracksource.h"
 #include "pc/videotrack.h"
+#include "rtc_base/experiments/congestion_controller_experiment.h"
 
 namespace webrtc {
 
@@ -55,7 +57,7 @@
     std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory) {
   return CreateModularPeerConnectionFactory(
       network_thread, worker_thread, signaling_thread, std::move(media_engine),
-      std::move(call_factory), std::move(event_log_factory), nullptr);
+      std::move(call_factory), std::move(event_log_factory), nullptr, nullptr);
 }
 
 rtc::scoped_refptr<PeerConnectionFactoryInterface>
@@ -66,12 +68,15 @@
     std::unique_ptr<cricket::MediaEngineInterface> media_engine,
     std::unique_ptr<CallFactoryInterface> call_factory,
     std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory,
-    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory) {
+    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
+    std::unique_ptr<NetworkControllerFactoryInterface>
+        network_controller_factory) {
   rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
       new rtc::RefCountedObject<PeerConnectionFactory>(
           network_thread, worker_thread, signaling_thread,
           std::move(media_engine), std::move(call_factory),
-          std::move(event_log_factory), std::move(fec_controller_factory)));
+          std::move(event_log_factory), std::move(fec_controller_factory),
+          std::move(network_controller_factory)));
 
   // Call Initialize synchronously but make sure it is executed on
   // |signaling_thread|.
@@ -99,6 +104,7 @@
                             std::move(media_engine),
                             std::move(call_factory),
                             std::move(event_log_factory),
+                            nullptr,
                             nullptr) {}
 
 PeerConnectionFactory::PeerConnectionFactory(
@@ -108,7 +114,9 @@
     std::unique_ptr<cricket::MediaEngineInterface> media_engine,
     std::unique_ptr<webrtc::CallFactoryInterface> call_factory,
     std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory,
-    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory)
+    std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
+    std::unique_ptr<NetworkControllerFactoryInterface>
+        network_controller_factory)
     : wraps_current_thread_(false),
       network_thread_(network_thread),
       worker_thread_(worker_thread),
@@ -116,7 +124,11 @@
       media_engine_(std::move(media_engine)),
       call_factory_(std::move(call_factory)),
       event_log_factory_(std::move(event_log_factory)),
-      fec_controller_factory_(std::move(fec_controller_factory)) {
+      fec_controller_factory_(std::move(fec_controller_factory)),
+      injected_network_controller_factory_(
+          std::move(network_controller_factory)),
+      bbr_network_controller_factory_(
+          rtc::MakeUnique<BbrNetworkControllerFactory>()) {
   if (!network_thread_) {
     owned_network_thread_ = rtc::Thread::CreateWithSocketServer();
     owned_network_thread_->SetName("pc_network_thread", nullptr);
@@ -391,6 +403,18 @@
 
   call_config.fec_controller_factory = fec_controller_factory_.get();
 
+  if (CongestionControllerExperiment::BbrControllerEnabled()) {
+    RTC_LOG(LS_INFO) << "Using BBR network controller factory";
+    call_config.network_controller_factory =
+        bbr_network_controller_factory_.get();
+  } else if (CongestionControllerExperiment::InjectedControllerEnabled()) {
+    RTC_LOG(LS_INFO) << "Using injected network controller factory";
+    call_config.network_controller_factory =
+        injected_network_controller_factory_.get();
+  } else {
+    RTC_LOG(LS_INFO) << "Using default network controller factory";
+  }
+
   return std::unique_ptr<Call>(call_factory_->CreateCall(call_config));
 }
 
diff --git a/pc/peerconnectionfactory.h b/pc/peerconnectionfactory.h
index 6fb3c24..b566dd3 100644
--- a/pc/peerconnectionfactory.h
+++ b/pc/peerconnectionfactory.h
@@ -116,7 +116,9 @@
       std::unique_ptr<cricket::MediaEngineInterface> media_engine,
       std::unique_ptr<webrtc::CallFactoryInterface> call_factory,
       std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory,
-      std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory);
+      std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
+      std::unique_ptr<NetworkControllerFactoryInterface>
+          network_controller_factory);
   virtual ~PeerConnectionFactory();
 
  private:
@@ -137,6 +139,10 @@
   std::unique_ptr<webrtc::CallFactoryInterface> call_factory_;
   std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory_;
   std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory_;
+  std::unique_ptr<NetworkControllerFactoryInterface>
+      injected_network_controller_factory_;
+  std::unique_ptr<NetworkControllerFactoryInterface>
+      bbr_network_controller_factory_;
 };
 
 }  // namespace webrtc
diff --git a/rtc_base/experiments/congestion_controller_experiment.cc b/rtc_base/experiments/congestion_controller_experiment.cc
index 5733fea..9fdaacd 100644
--- a/rtc_base/experiments/congestion_controller_experiment.cc
+++ b/rtc_base/experiments/congestion_controller_experiment.cc
@@ -16,21 +16,27 @@
 namespace webrtc {
 namespace {
 
-const char kBbrControllerExperiment[] = "WebRTC-BweCongestionController";
+const char kControllerExperiment[] = "WebRTC-BweCongestionController";
 }  // namespace
 
 bool CongestionControllerExperiment::BbrControllerEnabled() {
   std::string trial_string =
-      webrtc::field_trial::FindFullName(kBbrControllerExperiment);
+      webrtc::field_trial::FindFullName(kControllerExperiment);
   return trial_string.find("Enabled,BBR") == 0;
 }
 
+bool CongestionControllerExperiment::InjectedControllerEnabled() {
+  std::string trial_string =
+      webrtc::field_trial::FindFullName(kControllerExperiment);
+  return trial_string.find("Enabled,Injected") == 0;
+}
+
 rtc::Optional<CongestionControllerExperiment::BbrExperimentConfig>
 CongestionControllerExperiment::GetBbrExperimentConfig() {
   if (!BbrControllerEnabled())
     return rtc::nullopt;
   std::string trial_string =
-      webrtc::field_trial::FindFullName(kBbrControllerExperiment);
+      webrtc::field_trial::FindFullName(kControllerExperiment);
   BbrExperimentConfig config;
   if (sscanf(
           trial_string.c_str(),
diff --git a/rtc_base/experiments/congestion_controller_experiment.h b/rtc_base/experiments/congestion_controller_experiment.h
index 478d106..eba8926 100644
--- a/rtc_base/experiments/congestion_controller_experiment.h
+++ b/rtc_base/experiments/congestion_controller_experiment.h
@@ -33,6 +33,7 @@
     double probe_rtt_congestion_window_gain;
   };
   static bool BbrControllerEnabled();
+  static bool InjectedControllerEnabled();
   static rtc::Optional<BbrExperimentConfig> GetBbrExperimentConfig();
 };
 
diff --git a/test/call_test.cc b/test/call_test.cc
index 725a171..c111b11 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -178,7 +178,8 @@
 void CallTest::CreateSenderCall(const Call::Config& config) {
   std::unique_ptr<RtpTransportControllerSend> controller_send =
       rtc::MakeUnique<RtpTransportControllerSend>(
-          Clock::GetRealTimeClock(), config.event_log, config.bitrate_config);
+          Clock::GetRealTimeClock(), config.event_log,
+          config.network_controller_factory, config.bitrate_config);
   sender_call_transport_controller_ = controller_send.get();
   sender_call_.reset(Call::Create(config, std::move(controller_send)));
 }