Do not send max ack delay when it has the default value

QUIC+TLS already does this correctly, this CL changes QUIC_CRYPTO to do the same. In both cases, the QuicSentPacketManager uses the default value of kDefaultDelayedAckTimeMs unless it receives a different value from the config. It's therefore wasting bytes to send this value if it is equal to the default.

Do not send max ack delay if default, protected by gfe2_reloadable_flag_quic_dont_send_max_ack_delay_if_default

PiperOrigin-RevId: 317014803
Change-Id: Ie9746162e70652623c277bf5ab9a99ed577c64c5
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc
index b396020..30a5e2b 100644
--- a/quic/core/quic_config.cc
+++ b/quic/core/quic_config.cc
@@ -1006,7 +1006,17 @@
     max_unidirectional_streams_.ToHandshakeMessage(out);
     ack_delay_exponent_.ToHandshakeMessage(out);
   }
-  max_ack_delay_ms_.ToHandshakeMessage(out);
+  if (GetQuicReloadableFlag(quic_dont_send_max_ack_delay_if_default)) {
+    QUIC_RELOADABLE_FLAG_COUNT(quic_dont_send_max_ack_delay_if_default);
+    if (max_ack_delay_ms_.GetSendValue() != kDefaultDelayedAckTimeMs) {
+      // Only send max ack delay if it is using a non-default value, because
+      // the default value is used by QuicSentPacketManager if it is not
+      // sent during the handshake, and we want to save bytes.
+      max_ack_delay_ms_.ToHandshakeMessage(out);
+    }
+  } else {
+    max_ack_delay_ms_.ToHandshakeMessage(out);
+  }
   bytes_for_connection_id_.ToHandshakeMessage(out);
   initial_round_trip_time_us_.ToHandshakeMessage(out);
   initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out);