gfe-relnote: In QUIC, replace constant kMaxTrackedPackets with a flag. No functional change expected. Not protected.

PiperOrigin-RevId: 258433022
Change-Id: I4210547d3ef15d649b1ea962826b024443644ded
diff --git a/quic/core/congestion_control/bandwidth_sampler.cc b/quic/core/congestion_control/bandwidth_sampler.cc
index 88343b4..11a625c 100644
--- a/quic/core/congestion_control/bandwidth_sampler.cc
+++ b/quic/core/congestion_control/bandwidth_sampler.cc
@@ -20,7 +20,8 @@
       last_acked_packet_sent_time_(QuicTime::Zero()),
       last_acked_packet_ack_time_(QuicTime::Zero()),
       is_app_limited_(false),
-      connection_state_map_() {}
+      connection_state_map_(),
+      max_tracked_packets_(GetQuicFlag(FLAGS_quic_max_tracked_packet_count)) {}
 
 BandwidthSampler::~BandwidthSampler() {}
 
@@ -55,7 +56,7 @@
 
   if (!connection_state_map_.IsEmpty() &&
       packet_number >
-          connection_state_map_.last_packet() + kMaxTrackedPackets) {
+          connection_state_map_.last_packet() + max_tracked_packets_) {
     QUIC_BUG << "BandwidthSampler in-flight packet map has exceeded maximum "
                 "number "
                 "of tracked packets.";
diff --git a/quic/core/congestion_control/bandwidth_sampler.h b/quic/core/congestion_control/bandwidth_sampler.h
index 4de05b0..9a58cf6 100644
--- a/quic/core/congestion_control/bandwidth_sampler.h
+++ b/quic/core/congestion_control/bandwidth_sampler.h
@@ -324,6 +324,9 @@
   // sent, indexed by the packet number.
   PacketNumberIndexedQueue<ConnectionStateOnSentPacket> connection_state_map_;
 
+  // Maximum number of tracked packets.
+  const QuicPacketCount max_tracked_packets_;
+
   // Handles the actual bandwidth calculations, whereas the outer method handles
   // retrieving and removing |sent_packet|.
   BandwidthSample OnPacketAcknowledgedInner(
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index bc9043f..ecab751 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -244,7 +244,7 @@
       last_decrypted_packet_level_(ENCRYPTION_INITIAL),
       should_last_packet_instigate_acks_(false),
       max_undecryptable_packets_(0),
-      max_tracked_packets_(kMaxTrackedPackets),
+      max_tracked_packets_(GetQuicFlag(FLAGS_quic_max_tracked_packet_count)),
       pending_version_negotiation_packet_(false),
       send_ietf_version_negotiation_packet_(false),
       idle_timeout_connection_close_behavior_(
diff --git a/quic/core/quic_constants.h b/quic/core/quic_constants.h
index e718602..442fb09 100644
--- a/quic/core/quic_constants.h
+++ b/quic/core/quic_constants.h
@@ -87,9 +87,6 @@
 // Minimum size of the CWND, in packets, when doing bandwidth resumption.
 const QuicPacketCount kMinCongestionWindowForBandwidthResumption = 10;
 
-// Maximum number of tracked packets.
-const QuicPacketCount kMaxTrackedPackets = 10000;
-
 // Default size of the socket receive buffer in bytes.
 const QuicByteCount kDefaultSocketReceiveBuffer = 1024 * 1024;