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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 QuicTime::Delta BbrSender::TimeUntilSend(QuicTime /* now */, | 140 QuicTime::Delta BbrSender::TimeUntilSend(QuicTime /* now */, |
141 QuicByteCount bytes_in_flight) const { | 141 QuicByteCount bytes_in_flight) const { |
142 if (bytes_in_flight < GetCongestionWindow()) { | 142 if (bytes_in_flight < GetCongestionWindow()) { |
143 return QuicTime::Delta::Zero(); | 143 return QuicTime::Delta::Zero(); |
144 } | 144 } |
145 return QuicTime::Delta::Infinite(); | 145 return QuicTime::Delta::Infinite(); |
146 } | 146 } |
147 | 147 |
148 QuicBandwidth BbrSender::PacingRate(QuicByteCount /*bytes_in_flight*/) const { | 148 QuicBandwidth BbrSender::PacingRate(QuicByteCount bytes_in_flight) const { |
149 if (pacing_rate_.IsZero()) { | 149 if (pacing_rate_.IsZero()) { |
150 return kHighGain * QuicBandwidth::FromBytesAndTimeDelta( | 150 return kHighGain * QuicBandwidth::FromBytesAndTimeDelta( |
151 initial_congestion_window_, GetMinRtt()); | 151 initial_congestion_window_, GetMinRtt()); |
152 } | 152 } |
| 153 if (FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate && |
| 154 mode_ == PROBE_BW && bytes_in_flight > congestion_window_) { |
| 155 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate, |
| 156 1, 2); |
| 157 return max_bandwidth_.GetThirdBest(); |
| 158 } |
153 return pacing_rate_; | 159 return pacing_rate_; |
154 } | 160 } |
155 | 161 |
156 QuicBandwidth BbrSender::BandwidthEstimate() const { | 162 QuicBandwidth BbrSender::BandwidthEstimate() const { |
157 return max_bandwidth_.GetBest(); | 163 return max_bandwidth_.GetBest(); |
158 } | 164 } |
159 | 165 |
160 QuicByteCount BbrSender::GetCongestionWindow() const { | 166 QuicByteCount BbrSender::GetCongestionWindow() const { |
161 if (mode_ == PROBE_RTT) { | 167 if (mode_ == PROBE_RTT) { |
162 return kMinimumCongestionWindow; | 168 return kMinimumCongestionWindow; |
163 } | 169 } |
164 | 170 |
165 if (InRecovery()) { | 171 if (InRecovery()) { |
166 return std::min(congestion_window_, recovery_window_); | 172 return std::min(congestion_window_, recovery_window_); |
167 } | 173 } |
168 | 174 |
| 175 if (FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate && |
| 176 mode_ == PROBE_BW) { |
| 177 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate, |
| 178 2, 2); |
| 179 // Send for another SRTT at a more recently measured bandwidth. |
| 180 return congestion_window_ + |
| 181 max_bandwidth_.GetThirdBest() * rtt_stats_->smoothed_rtt(); |
| 182 } |
| 183 |
169 return congestion_window_; | 184 return congestion_window_; |
170 } | 185 } |
171 | 186 |
172 QuicByteCount BbrSender::GetSlowStartThreshold() const { | 187 QuicByteCount BbrSender::GetSlowStartThreshold() const { |
173 return 0; | 188 return 0; |
174 } | 189 } |
175 | 190 |
176 bool BbrSender::InRecovery() const { | 191 bool BbrSender::InRecovery() const { |
177 return recovery_state_ != NOT_IN_RECOVERY; | 192 return recovery_state_ != NOT_IN_RECOVERY; |
178 } | 193 } |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() | 727 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() |
713 << std::endl; | 728 << std::endl; |
714 | 729 |
715 os << "Last sample is app-limited: " | 730 os << "Last sample is app-limited: " |
716 << (state.last_sample_is_app_limited ? "yes" : "no"); | 731 << (state.last_sample_is_app_limited ? "yes" : "no"); |
717 | 732 |
718 return os; | 733 return os; |
719 } | 734 } |
720 | 735 |
721 } // namespace net | 736 } // namespace net |
OLD | NEW |