In uStreamer, add a quic_enable_bandwidth_overestimate_avoidance experiment flag and use it to enable bandwidth overestimate avoidance(connection option BSAO) for BBR and BBRv2.

In a follow up cl, I'll add two more experiments to QuicBbrV2Study, one for BBR+BSAO, another for BBRv2+BSAO.

(n/a) no behavior change.

PiperOrigin-RevId: 321646584
Change-Id: I35e3e037418d12bdd28355e13d3ae2401de4c7c0
diff --git a/quic/core/congestion_control/bbr2_misc.h b/quic/core/congestion_control/bbr2_misc.h
index bf22bc5..de30377 100644
--- a/quic/core/congestion_control/bbr2_misc.h
+++ b/quic/core/congestion_control/bbr2_misc.h
@@ -369,6 +369,10 @@
     bandwidth_sampler_.EnableOverestimateAvoidance();
   }
 
+  bool IsBandwidthOverestimateAvoidanceEnabled() const {
+    return bandwidth_sampler_.IsOverestimateAvoidanceEnabled();
+  }
+
   void OnPacketNeutered(QuicPacketNumber packet_number) {
     bandwidth_sampler_.OnPacketNeutered(packet_number);
   }
diff --git a/quic/core/congestion_control/bbr2_sender.cc b/quic/core/congestion_control/bbr2_sender.cc
index 3f80f42..3c7ba2f 100644
--- a/quic/core/congestion_control/bbr2_sender.cc
+++ b/quic/core/congestion_control/bbr2_sender.cc
@@ -95,9 +95,6 @@
   if (config.HasClientRequestedIndependentOption(kBBR9, perspective)) {
     params_.flexible_app_limited = true;
   }
-  if (config.HasClientRequestedIndependentOption(kBSAO, perspective)) {
-    model_.EnableOverestimateAvoidance();
-  }
   if (config.HasClientRequestedIndependentOption(kB2NA, perspective)) {
     params_.add_ack_height_to_queueing_threshold = false;
   }
@@ -139,6 +136,9 @@
     params_.startup_cwnd_gain = 2;
     params_.drain_cwnd_gain = 2;
   }
+  if (ContainsQuicTag(connection_options, kBSAO)) {
+    model_.EnableOverestimateAvoidance();
+  }
 }
 
 Limits<QuicByteCount> Bbr2Sender::GetCwndLimitsByMode() const {
diff --git a/quic/core/congestion_control/bbr2_sender.h b/quic/core/congestion_control/bbr2_sender.h
index 60824cd..39964a0 100644
--- a/quic/core/congestion_control/bbr2_sender.h
+++ b/quic/core/congestion_control/bbr2_sender.h
@@ -107,6 +107,10 @@
   // Returns the min of BDP and congestion window.
   QuicByteCount GetTargetBytesInflight() const;
 
+  bool IsBandwidthOverestimateAvoidanceEnabled() const {
+    return model_.IsBandwidthOverestimateAvoidanceEnabled();
+  }
+
   struct QUIC_EXPORT_PRIVATE DebugState {
     Bbr2Mode mode;
 
diff --git a/quic/core/congestion_control/bbr_sender.cc b/quic/core/congestion_control/bbr_sender.cc
index 11dff8c..b70bb333a 100644
--- a/quic/core/congestion_control/bbr_sender.cc
+++ b/quic/core/congestion_control/bbr_sender.cc
@@ -288,15 +288,16 @@
     max_congestion_window_with_network_parameters_adjusted_ =
         100 * kDefaultTCPMSS;
   }
-  if (config.HasClientRequestedIndependentOption(kBSAO, perspective)) {
-    sampler_.EnableOverestimateAvoidance();
-  }
 
   ApplyConnectionOptions(config.ClientRequestedIndependentOptions(perspective));
 }
 
 void BbrSender::ApplyConnectionOptions(
-    const QuicTagVector& /*connection_options*/) {}
+    const QuicTagVector& connection_options) {
+  if (ContainsQuicTag(connection_options, kBSAO)) {
+    sampler_.EnableOverestimateAvoidance();
+  }
+}
 
 void BbrSender::AdjustNetworkParameters(const NetworkParams& params) {
   const QuicBandwidth& bandwidth = params.bandwidth;