Removes trial to enable BBR congestion controller.

The BBR controller can still be injected, but the trials
will no longer work. This reduces the binary size.

Bug: webrtc:8415
Change-Id: I2c32c414d08ef0cc16bfd72651535a755cde9916
Reviewed-on: https://webrtc-review.googlesource.com/c/114120
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26077}
diff --git a/modules/congestion_controller/rtp/BUILD.gn b/modules/congestion_controller/rtp/BUILD.gn
index 9bf78bc..7330572 100644
--- a/modules/congestion_controller/rtp/BUILD.gn
+++ b/modules/congestion_controller/rtp/BUILD.gn
@@ -23,11 +23,6 @@
     "control_handler.h",
   ]
 
-  if (!build_with_chromium && is_clang) {
-    # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
-    suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
-  }
-
   deps = [
     "../:congestion_controller",
     "../../../api/transport:network_control",
@@ -38,7 +33,6 @@
     "../../../rtc_base:rate_limiter",
     "../../../rtc_base:safe_minmax",
     "../../../rtc_base:sequenced_task_checker",
-    "../../../rtc_base/experiments:congestion_controller_experiment",
     "../../../system_wrappers",
     "../../../system_wrappers:field_trial",
     "../../pacing",
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index e8ac9b9..2a07e71 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -208,12 +208,10 @@
     "../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/experiments:congestion_controller_experiment",
     "../rtc_base/system:rtc_export",
     "../rtc_base/third_party/base64",
     "../rtc_base/third_party/sigslot",
diff --git a/pc/peerconnectionfactory.cc b/pc/peerconnectionfactory.cc
index 37c6a0b..e1b3e6c 100644
--- a/pc/peerconnectionfactory.cc
+++ b/pc/peerconnectionfactory.cc
@@ -37,7 +37,6 @@
 #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"
@@ -46,7 +45,6 @@
 #include "pc/peerconnection.h"
 #include "pc/videocapturertracksource.h"
 #include "pc/videotrack.h"
-#include "rtc_base/experiments/congestion_controller_experiment.h"
 #include "system_wrappers/include/field_trial.h"
 
 namespace webrtc {
@@ -147,9 +145,7 @@
       event_log_factory_(std::move(event_log_factory)),
       fec_controller_factory_(std::move(fec_controller_factory)),
       injected_network_controller_factory_(
-          std::move(network_controller_factory)),
-      bbr_network_controller_factory_(
-          absl::make_unique<BbrNetworkControllerFactory>()) {
+          std::move(network_controller_factory)) {
   if (!network_thread_) {
     owned_network_thread_ = rtc::Thread::CreateWithSocketServer();
     owned_network_thread_->SetName("pc_network_thread", nullptr);
@@ -478,11 +474,7 @@
 
   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()) {
+  if (field_trial::IsEnabled("WebRTC-Bwe-InjectedCongestionController")) {
     RTC_LOG(LS_INFO) << "Using injected network controller factory";
     call_config.network_controller_factory =
         injected_network_controller_factory_.get();
diff --git a/pc/peerconnectionfactory.h b/pc/peerconnectionfactory.h
index 1c1ea94..e64eb10 100644
--- a/pc/peerconnectionfactory.h
+++ b/pc/peerconnectionfactory.h
@@ -151,8 +151,6 @@
   std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory_;
   std::unique_ptr<NetworkControllerFactoryInterface>
       injected_network_controller_factory_;
-  std::unique_ptr<NetworkControllerFactoryInterface>
-      bbr_network_controller_factory_;
   std::unique_ptr<MediaTransportFactory> media_transport_factory_;
 };
 
diff --git a/rtc_base/experiments/BUILD.gn b/rtc_base/experiments/BUILD.gn
index d36a43e..4b3f2a9 100644
--- a/rtc_base/experiments/BUILD.gn
+++ b/rtc_base/experiments/BUILD.gn
@@ -37,18 +37,6 @@
   ]
 }
 
-rtc_static_library("congestion_controller_experiment") {
-  sources = [
-    "congestion_controller_experiment.cc",
-    "congestion_controller_experiment.h",
-  ]
-  deps = [
-    "../:rtc_base_approved",
-    "../../system_wrappers:field_trial",
-    "//third_party/abseil-cpp/absl/types:optional",
-  ]
-}
-
 rtc_static_library("quality_scaling_experiment") {
   sources = [
     "quality_scaling_experiment.cc",
@@ -114,7 +102,6 @@
     testonly = true
 
     sources = [
-      "congestion_controller_experiment_unittest.cc",
       "cpu_speed_experiment_unittest.cc",
       "field_trial_parser_unittest.cc",
       "field_trial_units_unittest.cc",
@@ -123,7 +110,6 @@
       "rtt_mult_experiment_unittest.cc",
     ]
     deps = [
-      ":congestion_controller_experiment",
       ":cpu_speed_experiment",
       ":field_trial_parser",
       ":normalize_simulcast_size_experiment",
diff --git a/rtc_base/experiments/congestion_controller_experiment.cc b/rtc_base/experiments/congestion_controller_experiment.cc
deleted file mode 100644
index 2b7d776..0000000
--- a/rtc_base/experiments/congestion_controller_experiment.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-#include "rtc_base/experiments/congestion_controller_experiment.h"
-
-#include <string>
-
-#include "system_wrappers/include/field_trial.h"
-
-namespace webrtc {
-namespace {
-
-const char kControllerExperiment[] = "WebRTC-BweCongestionController";
-}  // namespace
-
-bool CongestionControllerExperiment::BbrControllerEnabled() {
-  std::string trial_string =
-      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;
-}
-}  // namespace webrtc
diff --git a/rtc_base/experiments/congestion_controller_experiment.h b/rtc_base/experiments/congestion_controller_experiment.h
deleted file mode 100644
index 1f2d8ae..0000000
--- a/rtc_base/experiments/congestion_controller_experiment.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef RTC_BASE_EXPERIMENTS_CONGESTION_CONTROLLER_EXPERIMENT_H_
-#define RTC_BASE_EXPERIMENTS_CONGESTION_CONTROLLER_EXPERIMENT_H_
-
-namespace webrtc {
-class CongestionControllerExperiment {
- public:
-  static bool BbrControllerEnabled();
-  static bool InjectedControllerEnabled();
-};
-
-}  // namespace webrtc
-
-#endif  // RTC_BASE_EXPERIMENTS_CONGESTION_CONTROLLER_EXPERIMENT_H_
diff --git a/rtc_base/experiments/congestion_controller_experiment_unittest.cc b/rtc_base/experiments/congestion_controller_experiment_unittest.cc
deleted file mode 100644
index a72abca..0000000
--- a/rtc_base/experiments/congestion_controller_experiment_unittest.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Copyright 2018 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "rtc_base/experiments/congestion_controller_experiment.h"
-
-#include "test/field_trial.h"
-#include "test/gtest.h"
-
-namespace webrtc {
-TEST(CongestionControllerExperimentTest, BbrDisabledByDefault) {
-  webrtc::test::ScopedFieldTrials field_trials("");
-  EXPECT_FALSE(CongestionControllerExperiment::BbrControllerEnabled());
-}
-
-TEST(CongestionControllerExperimentTest, BbrEnabledByFieldTrial) {
-  webrtc::test::ScopedFieldTrials field_trials(
-      "WebRTC-BweCongestionController/Enabled,BBR/");
-  EXPECT_TRUE(CongestionControllerExperiment::BbrControllerEnabled());
-}
-}  // namespace webrtc
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 43494d8..b9f3d0b 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -710,7 +710,6 @@
     "../modules/audio_device:mock_audio_device",
     "../modules/audio_mixer:audio_mixer_impl",
     "../modules/audio_processing",
-    "../modules/congestion_controller/bbr",
     "../modules/rtp_rtcp",
     "../modules/rtp_rtcp:mock_rtp_rtcp",
     "../modules/rtp_rtcp:rtp_rtcp_format",
@@ -723,7 +722,6 @@
     "../modules/video_coding:webrtc_vp9",
     "../rtc_base:checks",
     "../rtc_base:rtc_base_approved",
-    "../rtc_base/experiments:congestion_controller_experiment",
     "../system_wrappers",
     "../system_wrappers:field_trial",
     "../video",
diff --git a/test/call_test.cc b/test/call_test.cc
index 80b86f0..26c8b44 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -21,10 +21,8 @@
 #include "call/rtp_transport_controller_send.h"
 #include "call/simulated_network.h"
 #include "modules/audio_mixer/audio_mixer_impl.h"
-#include "modules/congestion_controller/bbr/bbr_factory.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/event.h"
-#include "rtc_base/experiments/congestion_controller_experiment.h"
 #include "test/fake_encoder.h"
 #include "test/testsupport/fileutils.h"
 
@@ -39,7 +37,6 @@
       audio_send_config_(/*send_transport=*/nullptr,
                          /*media_transport=*/nullptr),
       audio_send_stream_(nullptr),
-      bbr_network_controller_factory_(new BbrNetworkControllerFactory()),
       fake_encoder_factory_([this]() {
         std::unique_ptr<FakeEncoder> fake_encoder;
         if (video_encoder_configs_[0].codec_type == kVideoCodecVP8) {
@@ -200,14 +197,12 @@
 void CallTest::CreateSenderCall(const Call::Config& config) {
   NetworkControllerFactoryInterface* injected_factory =
       config.network_controller_factory;
-  if (!injected_factory) {
-    if (CongestionControllerExperiment::BbrControllerEnabled()) {
-      RTC_LOG(LS_INFO) << "Using BBR network controller factory";
-      injected_factory = bbr_network_controller_factory_.get();
-    } else {
-      RTC_LOG(LS_INFO) << "Using default network controller factory";
-    }
+  if (injected_factory) {
+    RTC_LOG(LS_INFO) << "Using injected network controller factory";
+  } else {
+    RTC_LOG(LS_INFO) << "Using default network controller factory";
   }
+
   std::unique_ptr<RtpTransportControllerSend> controller_send =
       absl::make_unique<RtpTransportControllerSend>(
           Clock::GetRealTimeClock(), config.event_log, injected_factory,
diff --git a/test/call_test.h b/test/call_test.h
index 220900b..c0ba1ff 100644
--- a/test/call_test.h
+++ b/test/call_test.h
@@ -198,8 +198,6 @@
       DegradationPreference::MAINTAIN_FRAMERATE;
 
   std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory_;
-  std::unique_ptr<NetworkControllerFactoryInterface>
-      bbr_network_controller_factory_;
 
   test::FunctionVideoEncoderFactory fake_encoder_factory_;
   int fake_encoder_max_bitrate_ = -1;