OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "net/quic/congestion_control/prr_sender.h" | 10 #include "net/quic/congestion_control/prr_sender.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // If we haven't measured an rtt, the bandwidth estimate is unknown. | 236 // If we haven't measured an rtt, the bandwidth estimate is unknown. |
237 return QuicBandwidth::Zero(); | 237 return QuicBandwidth::Zero(); |
238 } | 238 } |
239 return QuicBandwidth::FromBytesAndTimeDelta(GetCongestionWindow(), srtt); | 239 return QuicBandwidth::FromBytesAndTimeDelta(GetCongestionWindow(), srtt); |
240 } | 240 } |
241 | 241 |
242 QuicTime::Delta TcpCubicSenderBase::RetransmissionDelay() const { | 242 QuicTime::Delta TcpCubicSenderBase::RetransmissionDelay() const { |
243 if (rtt_stats_->smoothed_rtt().IsZero()) { | 243 if (rtt_stats_->smoothed_rtt().IsZero()) { |
244 return QuicTime::Delta::Zero(); | 244 return QuicTime::Delta::Zero(); |
245 } | 245 } |
246 return rtt_stats_->smoothed_rtt().Add( | 246 return rtt_stats_->smoothed_rtt() + 4 * rtt_stats_->mean_deviation(); |
247 rtt_stats_->mean_deviation().Multiply(4)); | |
248 } | 247 } |
249 | 248 |
250 bool TcpCubicSenderBase::InSlowStart() const { | 249 bool TcpCubicSenderBase::InSlowStart() const { |
251 return GetCongestionWindow() < GetSlowStartThreshold(); | 250 return GetCongestionWindow() < GetSlowStartThreshold(); |
252 } | 251 } |
253 | 252 |
254 bool TcpCubicSenderBase::IsCwndLimited(QuicByteCount bytes_in_flight) const { | 253 bool TcpCubicSenderBase::IsCwndLimited(QuicByteCount bytes_in_flight) const { |
255 const QuicByteCount congestion_window = GetCongestionWindow(); | 254 const QuicByteCount congestion_window = GetCongestionWindow(); |
256 if (bytes_in_flight >= congestion_window) { | 255 if (bytes_in_flight >= congestion_window) { |
257 return true; | 256 return true; |
(...skipping 21 matching lines...) Expand all Loading... |
279 void TcpCubicSenderBase::OnConnectionMigration() { | 278 void TcpCubicSenderBase::OnConnectionMigration() { |
280 hybrid_slow_start_.Restart(); | 279 hybrid_slow_start_.Restart(); |
281 prr_ = PrrSender(); | 280 prr_ = PrrSender(); |
282 largest_sent_packet_number_ = 0; | 281 largest_sent_packet_number_ = 0; |
283 largest_acked_packet_number_ = 0; | 282 largest_acked_packet_number_ = 0; |
284 largest_sent_at_last_cutback_ = 0; | 283 largest_sent_at_last_cutback_ = 0; |
285 last_cutback_exited_slowstart_ = false; | 284 last_cutback_exited_slowstart_ = false; |
286 } | 285 } |
287 | 286 |
288 } // namespace net | 287 } // namespace net |
OLD | NEW |