Handle receive timestamps properly when overestimate avoidance (kBSAO) is enabled I originally hoped we could just remove BSAO code after shipping timestamps; however, this is straightforward to implement, and removes a potential edge case. PiperOrigin-RevId: 984021496
diff --git a/quiche/quic/core/congestion_control/bandwidth_sampler.cc b/quiche/quic/core/congestion_control/bandwidth_sampler.cc index 9cbb714..82e9791 100644 --- a/quiche/quic/core/congestion_control/bandwidth_sampler.cc +++ b/quiche/quic/core/congestion_control/bandwidth_sampler.cc
@@ -200,7 +200,8 @@ last_acked_packet_receive_time_ = QuicTime::Zero(); if (overestimate_avoidance_) { recent_ack_points_.Clear(); - recent_ack_points_.Update(sent_time, total_bytes_acked_); + recent_ack_points_.Update(sent_time, QuicTime::Zero(), + total_bytes_acked_); a0_candidates_.clear(); a0_candidates_.push_back(recent_ack_points_.MostRecentPoint()); } @@ -399,10 +400,8 @@ last_acked_packet_ack_time_ = ack_time; last_acked_packet_receive_time_ = acked_packet.receive_timestamp; if (overestimate_avoidance_) { - // Note that this does not store `receive_timestamp`. Ideally, the receive - // timestamps prove sufficiently useful in dealing with overestimation that - // we can eventually remove `overestimate_avoidance_` altogether. - recent_ack_points_.Update(ack_time, total_bytes_acked_); + recent_ack_points_.Update(ack_time, acked_packet.receive_timestamp, + total_bytes_acked_); } if (is_app_limited_) {
diff --git a/quiche/quic/core/congestion_control/bandwidth_sampler.h b/quiche/quic/core/congestion_control/bandwidth_sampler.h index 2b7d705..d8f433b 100644 --- a/quiche/quic/core/congestion_control/bandwidth_sampler.h +++ b/quiche/quic/core/congestion_control/bandwidth_sampler.h
@@ -410,7 +410,8 @@ // RecentAckPoints maintains the most recent 2 ack points at distinct times. class QUICHE_EXPORT RecentAckPoints { public: - void Update(QuicTime ack_time, QuicByteCount total_bytes_acked) { + void Update(QuicTime ack_time, QuicTime receive_time, + QuicByteCount total_bytes_acked) { QUICHE_DCHECK_GE(total_bytes_acked, ack_points_[1].total_bytes_acked); if (ack_time < ack_points_[1].ack_time) { @@ -423,6 +424,7 @@ ack_points_[1].ack_time = ack_time; } + ack_points_[1].receive_time = receive_time; ack_points_[1].total_bytes_acked = total_bytes_acked; }
diff --git a/quiche/quic/core/congestion_control/bandwidth_sampler_test.cc b/quiche/quic/core/congestion_control/bandwidth_sampler_test.cc index 8bc491b..2a34327 100644 --- a/quiche/quic/core/congestion_control/bandwidth_sampler_test.cc +++ b/quiche/quic/core/congestion_control/bandwidth_sampler_test.cc
@@ -921,11 +921,6 @@ } TEST_P(BandwidthSamplerTest, ReceiveTimestamps) { - if (GetParam().overestimate_avoidance) { - // Receive timestamps are not used when overestimate avoidance is on. - GTEST_SKIP(); - } - constexpr QuicTimeDelta kTimeBetweenPackets = QuicTimeDelta::FromMilliseconds(10); constexpr QuicBandwidth kExpectedBandwidth =