OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/core/congestion_control/bbr_sender.h" | 5 #include "net/quic/core/congestion_control/bbr_sender.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "net/quic/core/congestion_control/rtt_stats.h" | 10 #include "net/quic/core/congestion_control/rtt_stats.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 return QuicTime::Delta::Zero(); | 185 return QuicTime::Delta::Zero(); |
186 } | 186 } |
187 return QuicTime::Delta::Infinite(); | 187 return QuicTime::Delta::Infinite(); |
188 } | 188 } |
189 | 189 |
190 QuicBandwidth BbrSender::PacingRate(QuicByteCount bytes_in_flight) const { | 190 QuicBandwidth BbrSender::PacingRate(QuicByteCount bytes_in_flight) const { |
191 if (pacing_rate_.IsZero()) { | 191 if (pacing_rate_.IsZero()) { |
192 return kHighGain * QuicBandwidth::FromBytesAndTimeDelta( | 192 return kHighGain * QuicBandwidth::FromBytesAndTimeDelta( |
193 initial_congestion_window_, GetMinRtt()); | 193 initial_congestion_window_, GetMinRtt()); |
194 } | 194 } |
195 if (FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate && | |
196 mode_ == PROBE_BW && bytes_in_flight > congestion_window_) { | |
197 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate, | |
198 1, 2); | |
199 if (pacing_gain_ > 1) { | |
200 return max_bandwidth_.GetBest(); | |
201 } else { | |
202 return max_bandwidth_.GetThirdBest(); | |
203 } | |
204 } | |
205 return pacing_rate_; | 195 return pacing_rate_; |
206 } | 196 } |
207 | 197 |
208 QuicBandwidth BbrSender::BandwidthEstimate() const { | 198 QuicBandwidth BbrSender::BandwidthEstimate() const { |
209 return max_bandwidth_.GetBest(); | 199 return max_bandwidth_.GetBest(); |
210 } | 200 } |
211 | 201 |
212 QuicByteCount BbrSender::GetCongestionWindow() const { | 202 QuicByteCount BbrSender::GetCongestionWindow() const { |
213 if (mode_ == PROBE_RTT) { | 203 if (mode_ == PROBE_RTT) { |
214 return kMinimumCongestionWindow; | 204 return kMinimumCongestionWindow; |
215 } | 205 } |
216 | 206 |
217 if (InRecovery()) { | 207 if (InRecovery()) { |
218 return std::min(congestion_window_, recovery_window_); | 208 return std::min(congestion_window_, recovery_window_); |
219 } | 209 } |
220 | 210 |
221 if (FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate && | |
222 mode_ == PROBE_BW && pacing_gain_ >= 1) { | |
223 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate, | |
224 2, 2); | |
225 // Send for another SRTT at a more recently measured bandwidth. | |
226 return congestion_window_ + | |
227 max_bandwidth_.GetThirdBest() * rtt_stats_->smoothed_rtt(); | |
228 } | |
229 | |
230 return congestion_window_; | 211 return congestion_window_; |
231 } | 212 } |
232 | 213 |
233 QuicByteCount BbrSender::GetSlowStartThreshold() const { | 214 QuicByteCount BbrSender::GetSlowStartThreshold() const { |
234 return 0; | 215 return 0; |
235 } | 216 } |
236 | 217 |
237 bool BbrSender::InRecovery() const { | 218 bool BbrSender::InRecovery() const { |
238 return recovery_state_ != NOT_IN_RECOVERY; | 219 return recovery_state_ != NOT_IN_RECOVERY; |
239 } | 220 } |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() | 830 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() |
850 << std::endl; | 831 << std::endl; |
851 | 832 |
852 os << "Last sample is app-limited: " | 833 os << "Last sample is app-limited: " |
853 << (state.last_sample_is_app_limited ? "yes" : "no"); | 834 << (state.last_sample_is_app_limited ? "yes" : "no"); |
854 | 835 |
855 return os; | 836 return os; |
856 } | 837 } |
857 | 838 |
858 } // namespace net | 839 } // namespace net |
OLD | NEW |