| 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/hybrid_slow_start.h" | 5 #include "net/quic/congestion_control/hybrid_slow_start.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 using std::max; | 9 using std::max; |
| 10 using std::min; | 10 using std::min; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Divide min_rtt by 8 to get a rtt increase threshold for exiting. | 87 // Divide min_rtt by 8 to get a rtt increase threshold for exiting. |
| 88 int64_t min_rtt_increase_threshold_us = | 88 int64_t min_rtt_increase_threshold_us = |
| 89 min_rtt.ToMicroseconds() >> kHybridStartDelayFactorExp; | 89 min_rtt.ToMicroseconds() >> kHybridStartDelayFactorExp; |
| 90 // Ensure the rtt threshold is never less than 2ms or more than 16ms. | 90 // Ensure the rtt threshold is never less than 2ms or more than 16ms. |
| 91 min_rtt_increase_threshold_us = | 91 min_rtt_increase_threshold_us = |
| 92 min(min_rtt_increase_threshold_us, kHybridStartDelayMaxThresholdUs); | 92 min(min_rtt_increase_threshold_us, kHybridStartDelayMaxThresholdUs); |
| 93 QuicTime::Delta min_rtt_increase_threshold = | 93 QuicTime::Delta min_rtt_increase_threshold = |
| 94 QuicTime::Delta::FromMicroseconds(max(min_rtt_increase_threshold_us, | 94 QuicTime::Delta::FromMicroseconds(max(min_rtt_increase_threshold_us, |
| 95 kHybridStartDelayMinThresholdUs)); | 95 kHybridStartDelayMinThresholdUs)); |
| 96 | 96 |
| 97 if (current_min_rtt_ > min_rtt.Add(min_rtt_increase_threshold)) { | 97 if (current_min_rtt_ > min_rtt + min_rtt_increase_threshold) { |
| 98 hystart_found_ = DELAY; | 98 hystart_found_ = DELAY; |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 // Exit from slow start if the cwnd is greater than 16 and | 101 // Exit from slow start if the cwnd is greater than 16 and |
| 102 // increasing delay is found. | 102 // increasing delay is found. |
| 103 return congestion_window >= kHybridStartLowWindow && | 103 return congestion_window >= kHybridStartLowWindow && |
| 104 hystart_found_ != NOT_FOUND; | 104 hystart_found_ != NOT_FOUND; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace net | 107 } // namespace net |
| OLD | NEW |