Remove field trial string WebRTC-AdaptiveBweThreshold and cleanup

Removed old disabled tests
enable test on android

Bug: webrtc:4711
Change-Id: Ic9adbdadc9e847bdf31b8be4ce116a3695499944
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284922
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38736}
diff --git a/modules/remote_bitrate_estimator/aimd_rate_control.cc b/modules/remote_bitrate_estimator/aimd_rate_control.cc
index b625a74..c8c7ca9 100644
--- a/modules/remote_bitrate_estimator/aimd_rate_control.cc
+++ b/modules/remote_bitrate_estimator/aimd_rate_control.cc
@@ -86,7 +86,6 @@
       in_alr_(false),
       rtt_(kDefaultRtt),
       send_side_(send_side),
-      in_experiment_(!AdaptiveThresholdExperimentIsDisabled(*key_value_config)),
       no_bitrate_increase_in_alr_(
           IsEnabled(*key_value_config,
                     "WebRTC-DontIncreaseDelayBasedBweInAlr")),
@@ -233,7 +232,7 @@
 
   // Approximate the over-use estimator delay to 100 ms.
   TimeDelta response_time = rtt_ + TimeDelta::Millis(100);
-  if (in_experiment_)
+
     response_time = response_time * 2;
   double increase_rate_bps_per_second =
       (avg_packet_size / response_time).bps<double>();
diff --git a/modules/remote_bitrate_estimator/aimd_rate_control.h b/modules/remote_bitrate_estimator/aimd_rate_control.h
index 6c770cd..ce226c9 100644
--- a/modules/remote_bitrate_estimator/aimd_rate_control.h
+++ b/modules/remote_bitrate_estimator/aimd_rate_control.h
@@ -100,7 +100,6 @@
   bool in_alr_;
   TimeDelta rtt_;
   const bool send_side_;
-  const bool in_experiment_;
   // Allow the delay based estimate to only increase as long as application
   // limited region (alr) is not detected.
   const bool no_bitrate_increase_in_alr_;
diff --git a/modules/remote_bitrate_estimator/overuse_detector.cc b/modules/remote_bitrate_estimator/overuse_detector.cc
index 672822b..bd2d756 100644
--- a/modules/remote_bitrate_estimator/overuse_detector.cc
+++ b/modules/remote_bitrate_estimator/overuse_detector.cc
@@ -22,57 +22,22 @@
 
 namespace webrtc {
 
-const char kAdaptiveThresholdExperiment[] = "WebRTC-AdaptiveBweThreshold";
-const char kEnabledPrefix[] = "Enabled";
-const size_t kEnabledPrefixLength = sizeof(kEnabledPrefix) - 1;
-const char kDisabledPrefix[] = "Disabled";
-const size_t kDisabledPrefixLength = sizeof(kDisabledPrefix) - 1;
-
 const double kMaxAdaptOffsetMs = 15.0;
 const double kOverUsingTimeThreshold = 10;
 const int kMaxNumDeltas = 60;
 
-bool AdaptiveThresholdExperimentIsDisabled(
-    const FieldTrialsView& key_value_config) {
-  std::string experiment_string =
-      key_value_config.Lookup(kAdaptiveThresholdExperiment);
-  const size_t kMinExperimentLength = kDisabledPrefixLength;
-  if (experiment_string.length() < kMinExperimentLength)
-    return false;
-  return experiment_string.substr(0, kDisabledPrefixLength) == kDisabledPrefix;
-}
-
-// Gets thresholds from the experiment name following the format
-// "WebRTC-AdaptiveBweThreshold/Enabled-0.5,0.002/".
-bool ReadExperimentConstants(const FieldTrialsView& key_value_config,
-                             double* k_up,
-                             double* k_down) {
-  std::string experiment_string =
-      key_value_config.Lookup(kAdaptiveThresholdExperiment);
-  const size_t kMinExperimentLength = kEnabledPrefixLength + 3;
-  if (experiment_string.length() < kMinExperimentLength ||
-      experiment_string.substr(0, kEnabledPrefixLength) != kEnabledPrefix)
-    return false;
-  return sscanf(experiment_string.substr(kEnabledPrefixLength + 1).c_str(),
-                "%lf,%lf", k_up, k_down) == 2;
-}
-
 OveruseDetector::OveruseDetector(const FieldTrialsView* key_value_config)
     // Experiment is on by default, but can be disabled with finch by setting
     // the field trial string to "WebRTC-AdaptiveBweThreshold/Disabled/".
-    : in_experiment_(!AdaptiveThresholdExperimentIsDisabled(*key_value_config)),
-      k_up_(0.0087),
+    : k_up_(0.0087),
       k_down_(0.039),
-      overusing_time_threshold_(100),
+      overusing_time_threshold_(kOverUsingTimeThreshold),
       threshold_(12.5),
       last_update_ms_(-1),
       prev_offset_(0.0),
       time_over_using_(-1),
       overuse_counter_(0),
-      hypothesis_(BandwidthUsage::kBwNormal) {
-  if (!AdaptiveThresholdExperimentIsDisabled(*key_value_config))
-    InitializeExperiment(*key_value_config);
-}
+      hypothesis_(BandwidthUsage::kBwNormal) {}
 
 OveruseDetector::~OveruseDetector() {}
 
@@ -125,9 +90,6 @@
 }
 
 void OveruseDetector::UpdateThreshold(double modified_offset, int64_t now_ms) {
-  if (!in_experiment_)
-    return;
-
   if (last_update_ms_ == -1)
     last_update_ms_ = now_ms;
 
@@ -146,15 +108,4 @@
   last_update_ms_ = now_ms;
 }
 
-void OveruseDetector::InitializeExperiment(
-    const FieldTrialsView& key_value_config) {
-  RTC_DCHECK(in_experiment_);
-  double k_up = 0.0;
-  double k_down = 0.0;
-  overusing_time_threshold_ = kOverUsingTimeThreshold;
-  if (ReadExperimentConstants(key_value_config, &k_up, &k_down)) {
-    k_up_ = k_up;
-    k_down_ = k_down;
-  }
-}
 }  // namespace webrtc
diff --git a/modules/remote_bitrate_estimator/overuse_detector.h b/modules/remote_bitrate_estimator/overuse_detector.h
index dfaea91..07ae873 100644
--- a/modules/remote_bitrate_estimator/overuse_detector.h
+++ b/modules/remote_bitrate_estimator/overuse_detector.h
@@ -17,9 +17,6 @@
 
 namespace webrtc {
 
-bool AdaptiveThresholdExperimentIsDisabled(
-    const FieldTrialsView& key_value_config);
-
 class OveruseDetector {
  public:
   explicit OveruseDetector(const FieldTrialsView* key_value_config);
@@ -46,10 +43,9 @@
   void UpdateThreshold(double modified_offset, int64_t now_ms);
   void InitializeExperiment(const FieldTrialsView& key_value_config);
 
-  bool in_experiment_;
-  double k_up_;
-  double k_down_;
-  double overusing_time_threshold_;
+  const double k_up_;
+  const double k_down_;
+  const double overusing_time_threshold_;
   double threshold_;
   int64_t last_update_ms_;
   double prev_offset_;
diff --git a/modules/remote_bitrate_estimator/overuse_detector_unittest.cc b/modules/remote_bitrate_estimator/overuse_detector_unittest.cc
index 8420af9..e91d4f0 100644
--- a/modules/remote_bitrate_estimator/overuse_detector_unittest.cc
+++ b/modules/remote_bitrate_estimator/overuse_detector_unittest.cc
@@ -21,7 +21,6 @@
 #include "modules/remote_bitrate_estimator/inter_arrival.h"
 #include "modules/remote_bitrate_estimator/overuse_estimator.h"
 #include "rtc_base/random.h"
-#include "test/field_trial.h"
 #include "test/gtest.h"
 
 namespace webrtc {
@@ -218,69 +217,6 @@
   EXPECT_EQ(7, frames_until_overuse);
 }
 
-TEST_F(OveruseDetectorTest, DISABLED_OveruseWithHighVariance100Kbit10fps) {
-  uint32_t frame_duration_ms = 100;
-  uint32_t drift_per_frame_ms = 10;
-  uint32_t rtp_timestamp = frame_duration_ms * 90;
-  size_t packet_size = 1200;
-  int offset = 10;
-
-  // Run 1000 samples to reach steady state.
-  for (int i = 0; i < 1000; ++i) {
-    UpdateDetector(rtp_timestamp, now_ms_, packet_size);
-    rtp_timestamp += frame_duration_ms * 90;
-    if (i % 2) {
-      offset = random_.Rand(0, 49);
-      now_ms_ += frame_duration_ms - offset;
-    } else {
-      now_ms_ += frame_duration_ms + offset;
-    }
-    EXPECT_EQ(BandwidthUsage::kBwNormal, overuse_detector_->State());
-  }
-  // Simulate a higher send pace, that is too high.
-  // Above noise generate a standard deviation of approximately 28 ms.
-  // Total build up of 150 ms.
-  for (int j = 0; j < 15; ++j) {
-    UpdateDetector(rtp_timestamp, now_ms_, packet_size);
-    now_ms_ += frame_duration_ms + drift_per_frame_ms;
-    rtp_timestamp += frame_duration_ms * 90;
-    EXPECT_EQ(BandwidthUsage::kBwNormal, overuse_detector_->State());
-  }
-  UpdateDetector(rtp_timestamp, now_ms_, packet_size);
-  EXPECT_EQ(BandwidthUsage::kBwOverusing, overuse_detector_->State());
-}
-
-TEST_F(OveruseDetectorTest, DISABLED_OveruseWithLowVariance100Kbit10fps) {
-  uint32_t frame_duration_ms = 100;
-  uint32_t drift_per_frame_ms = 1;
-  uint32_t rtp_timestamp = frame_duration_ms * 90;
-  size_t packet_size = 1200;
-  int offset = 10;
-
-  // Run 1000 samples to reach steady state.
-  for (int i = 0; i < 1000; ++i) {
-    UpdateDetector(rtp_timestamp, now_ms_, packet_size);
-    rtp_timestamp += frame_duration_ms * 90;
-    if (i % 2) {
-      offset = random_.Rand(0, 1);
-      now_ms_ += frame_duration_ms - offset;
-    } else {
-      now_ms_ += frame_duration_ms + offset;
-    }
-    EXPECT_EQ(BandwidthUsage::kBwNormal, overuse_detector_->State());
-  }
-  // Simulate a higher send pace, that is too high.
-  // Total build up of 6 ms.
-  for (int j = 0; j < 6; ++j) {
-    UpdateDetector(rtp_timestamp, now_ms_, packet_size);
-    now_ms_ += frame_duration_ms + drift_per_frame_ms;
-    rtp_timestamp += frame_duration_ms * 90;
-    EXPECT_EQ(BandwidthUsage::kBwNormal, overuse_detector_->State());
-  }
-  UpdateDetector(rtp_timestamp, now_ms_, packet_size);
-  EXPECT_EQ(BandwidthUsage::kBwOverusing, overuse_detector_->State());
-}
-
 TEST_F(OveruseDetectorTest, OveruseWithLowVariance2000Kbit30fps) {
   uint32_t frame_duration_ms = 33;
   uint32_t drift_per_frame_ms = 1;
@@ -322,13 +258,7 @@
   EXPECT_EQ(BandwidthUsage::kBwOverusing, overuse_detector_->State());
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_LowGaussianVariance30Kbit3fps \
-  DISABLED_LowGaussianVariance30Kbit3fps
-#else
-#define MAYBE_LowGaussianVariance30Kbit3fps LowGaussianVariance30Kbit3fps
-#endif
-TEST_F(OveruseDetectorTest, MAYBE_LowGaussianVariance30Kbit3fps) {
+TEST_F(OveruseDetectorTest, LowGaussianVariance30Kbit3fps) {
   size_t packet_size = 1200;
   int packets_per_frame = 1;
   int frame_duration_ms = 333;
@@ -388,13 +318,7 @@
   EXPECT_EQ(4, frames_until_overuse);
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_LowGaussianVariance100Kbit5fps \
-  DISABLED_LowGaussianVariance100Kbit5fps
-#else
-#define MAYBE_LowGaussianVariance100Kbit5fps LowGaussianVariance100Kbit5fps
-#endif
-TEST_F(OveruseDetectorTest, MAYBE_LowGaussianVariance100Kbit5fps) {
+TEST_F(OveruseDetectorTest, LowGaussianVariance100Kbit5fps) {
   size_t packet_size = 1200;
   int packets_per_frame = 2;
   int frame_duration_ms = 200;
@@ -409,13 +333,7 @@
   EXPECT_EQ(20, frames_until_overuse);
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_HighGaussianVariance100Kbit5fps \
-  DISABLED_HighGaussianVariance100Kbit5fps
-#else
-#define MAYBE_HighGaussianVariance100Kbit5fps HighGaussianVariance100Kbit5fps
-#endif
-TEST_F(OveruseDetectorTest, MAYBE_HighGaussianVariance100Kbit5fps) {
+TEST_F(OveruseDetectorTest, HighGaussianVariance100Kbit5fps) {
   size_t packet_size = 1200;
   int packets_per_frame = 2;
   int frame_duration_ms = 200;
@@ -430,13 +348,7 @@
   EXPECT_EQ(44, frames_until_overuse);
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_LowGaussianVariance100Kbit10fps \
-  DISABLED_LowGaussianVariance100Kbit10fps
-#else
-#define MAYBE_LowGaussianVariance100Kbit10fps LowGaussianVariance100Kbit10fps
-#endif
-TEST_F(OveruseDetectorTest, MAYBE_LowGaussianVariance100Kbit10fps) {
+TEST_F(OveruseDetectorTest, LowGaussianVariance100Kbit10fps) {
   size_t packet_size = 1200;
   int packets_per_frame = 1;
   int frame_duration_ms = 100;
@@ -451,13 +363,7 @@
   EXPECT_EQ(20, frames_until_overuse);
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_HighGaussianVariance100Kbit10fps \
-  DISABLED_HighGaussianVariance100Kbit10fps
-#else
-#define MAYBE_HighGaussianVariance100Kbit10fps HighGaussianVariance100Kbit10fps
-#endif
-TEST_F(OveruseDetectorTest, MAYBE_HighGaussianVariance100Kbit10fps) {
+TEST_F(OveruseDetectorTest, HighGaussianVariance100Kbit10fps) {
   size_t packet_size = 1200;
   int packets_per_frame = 1;
   int frame_duration_ms = 100;
@@ -472,13 +378,7 @@
   EXPECT_EQ(44, frames_until_overuse);
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_LowGaussianVariance300Kbit30fps \
-  DISABLED_LowGaussianVariance300Kbit30fps
-#else
-#define MAYBE_LowGaussianVariance300Kbit30fps LowGaussianVariance300Kbit30fps
-#endif
-TEST_F(OveruseDetectorTest, MAYBE_LowGaussianVariance300Kbit30fps) {
+TEST_F(OveruseDetectorTest, LowGaussianVariance300Kbit30fps) {
   size_t packet_size = 1200;
   int packets_per_frame = 1;
   int frame_duration_ms = 33;
@@ -538,13 +438,7 @@
   EXPECT_EQ(10, frames_until_overuse);
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_LowGaussianVariance1000Kbit30fps \
-  DISABLED_LowGaussianVariance1000Kbit30fps
-#else
-#define MAYBE_LowGaussianVariance1000Kbit30fps LowGaussianVariance1000Kbit30fps
-#endif
-TEST_F(OveruseDetectorTest, MAYBE_LowGaussianVariance1000Kbit30fps) {
+TEST_F(OveruseDetectorTest, LowGaussianVariance1000Kbit30fps) {
   size_t packet_size = 1200;
   int packets_per_frame = 3;
   int frame_duration_ms = 33;
@@ -604,13 +498,7 @@
   EXPECT_EQ(10, frames_until_overuse);
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_LowGaussianVariance2000Kbit30fps \
-  DISABLED_LowGaussianVariance2000Kbit30fps
-#else
-#define MAYBE_LowGaussianVariance2000Kbit30fps LowGaussianVariance2000Kbit30fps
-#endif
-TEST_F(OveruseDetectorTest, MAYBE_LowGaussianVariance2000Kbit30fps) {
+TEST_F(OveruseDetectorTest, LowGaussianVariance2000Kbit30fps) {
   size_t packet_size = 1200;
   int packets_per_frame = 6;
   int frame_duration_ms = 33;
@@ -670,22 +558,7 @@
   EXPECT_EQ(10, frames_until_overuse);
 }
 
-class OveruseDetectorExperimentTest : public OveruseDetectorTest {
- public:
-  OveruseDetectorExperimentTest()
-      : override_field_trials_(
-            "WebRTC-AdaptiveBweThreshold/Enabled-0.01,0.00018/") {}
-
- protected:
-  void SetUp() override {
-    overuse_detector_.reset(new OveruseDetector(&field_trials_));
-  }
-
-  test::ScopedFieldTrials override_field_trials_;
-  const FieldTrialBasedConfig field_trials_;
-};
-
-TEST_F(OveruseDetectorExperimentTest, ThresholdAdapts) {
+TEST_F(OveruseDetectorTest, ThresholdAdapts) {
   const double kOffset = 0.21;
   double kTsDelta = 3000.0;
   int64_t now_ms = 0;
@@ -756,7 +629,7 @@
   EXPECT_TRUE(overuse_detected);
 }
 
-TEST_F(OveruseDetectorExperimentTest, DoesntAdaptToSpikes) {
+TEST_F(OveruseDetectorTest, DoesntAdaptToSpikes) {
   const double kOffset = 1.0;
   const double kLargeOffset = 20.0;
   double kTsDelta = 3000.0;