Move local_delayed_ack_time from QuicSentPacketManager to QuicReceivedPacketManager, set the delayed ack time to 1ms for Initial and Handshake packet number spaces when using v99, and use peer_delayed_ack_time instead of local_delayed_ack_time when with the MAD1 connection option.

gfe-relnote: n/a (Refactor or v99 only)
PiperOrigin-RevId: 261378188
Change-Id: I4bfed0bde6fa58506250b766294221f1aaf9fc29
diff --git a/quic/core/quic_received_packet_manager.cc b/quic/core/quic_received_packet_manager.cc
index 2994748..e21f4c4 100644
--- a/quic/core/quic_received_packet_manager.cc
+++ b/quic/core/quic_received_packet_manager.cc
@@ -58,6 +58,8 @@
       ack_decimation_delay_(kAckDecimationDelay),
       unlimited_ack_decimation_(false),
       fast_ack_after_quiescence_(false),
+      local_max_ack_delay_(
+          QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs)),
       ack_timeout_(QuicTime::Zero()),
       time_of_previous_received_packet_(QuicTime::Zero()),
       was_last_packet_missing_(false) {
@@ -218,8 +220,7 @@
     QuicPacketNumber last_received_packet_number,
     QuicTime time_of_last_received_packet,
     QuicTime now,
-    const RttStats* rtt_stats,
-    QuicTime::Delta local_max_ack_delay) {
+    const RttStats* rtt_stats) {
   if (!ack_frame_updated_) {
     // ACK frame has not been updated, nothing to do.
     return;
@@ -251,7 +252,7 @@
     // Wait for the minimum of the ack decimation delay or the delayed ack time
     // before sending an ack.
     QuicTime::Delta ack_delay = std::min(
-        local_max_ack_delay, rtt_stats->min_rtt() * ack_decimation_delay_);
+        local_max_ack_delay_, rtt_stats->min_rtt() * ack_decimation_delay_);
     if (fast_ack_after_quiescence_ && now - time_of_previous_received_packet_ >
                                           rtt_stats->SmoothedOrInitialRtt()) {
       // Ack the first packet out of queiscence faster, because QUIC does
@@ -273,7 +274,7 @@
       // or TLP packets, which we'd like to acknowledge quickly.
       MaybeUpdateAckTimeoutTo(now + QuicTime::Delta::FromMilliseconds(1));
     } else {
-      MaybeUpdateAckTimeoutTo(now + local_max_ack_delay);
+      MaybeUpdateAckTimeoutTo(now + local_max_ack_delay_);
     }
   }