Change default path degrading delay to 4PTOs when PTO is enabled.

PiperOrigin-RevId: 440208495
diff --git a/quiche/quic/core/crypto/crypto_protocol.h b/quiche/quic/core/crypto/crypto_protocol.h
index ab21cb5..e9a2785 100644
--- a/quiche/quic/core/crypto/crypto_protocol.h
+++ b/quiche/quic/core/crypto/crypto_protocol.h
@@ -30,7 +30,7 @@
 // "1CON", "BBQ4", "NCON", "RCID", "SREJ", "TBKP", "TB10", "SCLS", "SMHL",
 // "QNZR", "B2HI", "H2PR", "FIFO", "LIFO", "RRWS", "QNSP", "B2CL", "CHSP",
 // "BPTE", "ACKD", "AKD2", "AKD4", "MAD1", "MAD4", "MAD5", "ACD0", "ACKQ",
-// "TLPR", "CCS\0"
+// "TLPR", "CCS\0", "PDP4"
 
 // clang-format off
 const QuicTag kCHLO = TAG('C', 'H', 'L', 'O');   // Client hello
@@ -411,9 +411,6 @@
 const QuicTag kPDP3 = TAG('P', 'D', 'P', '3');   // Path degrading triggered
                                                  // at 3PTO.
 
-const QuicTag kPDP4 = TAG('P', 'D', 'P', '4');   // Path degrading triggered
-                                                 // at 4PTO.
-
 const QuicTag kPDP5 = TAG('P', 'D', 'P', '5');   // Path degrading triggered
                                                  // at 5PTO.
 
diff --git a/quiche/quic/core/quic_sent_packet_manager.cc b/quiche/quic/core/quic_sent_packet_manager.cc
index a77dddb..d91613f 100644
--- a/quiche/quic/core/quic_sent_packet_manager.cc
+++ b/quiche/quic/core/quic_sent_packet_manager.cc
@@ -61,6 +61,9 @@
 // losses.
 static const uint32_t kConservativeUnpacedBurst = 2;
 
+// The default number of PTOs to trigger path degrading.
+static const uint32_t kNumProbeTimeoutsForPathDegradingDelay = 4;
+
 }  // namespace
 
 #define ENDPOINT                                                         \
@@ -112,7 +115,7 @@
       first_pto_srtt_multiplier_(0),
       use_standard_deviation_for_pto_(false),
       pto_multiplier_without_rtt_samples_(3),
-      num_ptos_for_path_degrading_(0),
+      num_ptos_for_path_degrading_(kNumProbeTimeoutsForPathDegradingDelay),
       ignore_pings_(false),
       ignore_ack_delay_(false) {
   SetSendAlgorithm(congestion_control_type);
@@ -237,9 +240,6 @@
     if (config.HasClientRequestedIndependentOption(kPDP3, perspective)) {
       num_ptos_for_path_degrading_ = 3;
     }
-    if (config.HasClientRequestedIndependentOption(kPDP4, perspective)) {
-      num_ptos_for_path_degrading_ = 4;
-    }
     if (config.HasClientRequestedIndependentOption(kPDP5, perspective)) {
       num_ptos_for_path_degrading_ = 5;
     }
@@ -1388,7 +1388,8 @@
 }
 
 const QuicTime::Delta QuicSentPacketManager::GetPathDegradingDelay() const {
-  if (num_ptos_for_path_degrading_ > 0) {
+  if (pto_enabled_) {
+    QUICHE_DCHECK_GT(num_ptos_for_path_degrading_, 0);
     return num_ptos_for_path_degrading_ * GetPtoDelay();
   }
   return GetNConsecutiveRetransmissionTimeoutDelay(
diff --git a/quiche/quic/core/quic_sent_packet_manager_test.cc b/quiche/quic/core/quic_sent_packet_manager_test.cc
index 61e7f2a..fc16612 100644
--- a/quiche/quic/core/quic_sent_packet_manager_test.cc
+++ b/quiche/quic/core/quic_sent_packet_manager_test.cc
@@ -3908,7 +3908,10 @@
       QuicSentPacketManagerPeer::UsePacketThresholdForRuntPackets(&manager_));
 }
 
-TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelay) {
+TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayNonPto) {
+  if (GetQuicRestartFlag(quic_default_on_pto2)) {
+    return;
+  }
   QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
   // Before RTT sample is available.
   // 2 TLPs + 2 RTOs.
@@ -3951,6 +3954,15 @@
   EXPECT_EQ(expected_delay, manager_.GetPathDegradingDelay());
 }
 
+TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayDefaultPTO) {
+  if (!GetQuicRestartFlag(quic_default_on_pto2)) {
+    return;
+  }
+  QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
+  QuicTime::Delta expected_delay = 4 * manager_.GetPtoDelay();
+  EXPECT_EQ(expected_delay, manager_.GetPathDegradingDelay());
+}
+
 TEST_F(QuicSentPacketManagerTest, GetPathDegradingDelayUsing2PTO) {
   QuicConfig client_config;
   QuicTagVector options;