| Index: net/quic/congestion_control/paced_sender.cc
|
| diff --git a/net/quic/congestion_control/paced_sender.cc b/net/quic/congestion_control/paced_sender.cc
|
| index f44aa338a520ad0f8c444db25b08cd60fd002b1b..dd116a809558ba404d437ea0170d50081d2b7ce1 100644
|
| --- a/net/quic/congestion_control/paced_sender.cc
|
| +++ b/net/quic/congestion_control/paced_sender.cc
|
| @@ -14,21 +14,23 @@ const int64 kMinPacketBurstSize = 2;
|
| // AvailableCongestionWindow.
|
| const int64 kMaxSchedulingDelayUs = 2000;
|
|
|
| -PacedSender::PacedSender(const QuicClock* clock, QuicBandwidth estimate)
|
| - : leaky_bucket_(clock, estimate),
|
| +PacedSender::PacedSender(QuicBandwidth estimate)
|
| + : leaky_bucket_(estimate),
|
| pace_(estimate) {
|
| }
|
|
|
| -void PacedSender::UpdateBandwidthEstimate(QuicBandwidth estimate) {
|
| - leaky_bucket_.SetDrainingRate(estimate);
|
| +void PacedSender::UpdateBandwidthEstimate(QuicTime now,
|
| + QuicBandwidth estimate) {
|
| + leaky_bucket_.SetDrainingRate(now, estimate);
|
| pace_ = estimate;
|
| }
|
|
|
| -void PacedSender::SentPacket(QuicByteCount bytes) {
|
| - leaky_bucket_.Add(bytes);
|
| +void PacedSender::SentPacket(QuicTime now, QuicByteCount bytes) {
|
| + leaky_bucket_.Add(now, bytes);
|
| }
|
|
|
| -QuicTime::Delta PacedSender::TimeUntilSend(QuicTime::Delta time_until_send) {
|
| +QuicTime::Delta PacedSender::TimeUntilSend(QuicTime now,
|
| + QuicTime::Delta time_until_send) {
|
| if (time_until_send.ToMicroseconds() >= kMaxSchedulingDelayUs) {
|
| return time_until_send;
|
| }
|
| @@ -38,36 +40,11 @@ QuicTime::Delta PacedSender::TimeUntilSend(QuicTime::Delta time_until_send) {
|
| QuicByteCount min_window_size = kMinPacketBurstSize * kMaxPacketSize;
|
| pacing_window = std::max(pacing_window, min_window_size);
|
|
|
| - if (pacing_window > leaky_bucket_.BytesPending()) {
|
| + if (pacing_window > leaky_bucket_.BytesPending(now)) {
|
| // We have not filled our pacing window yet.
|
| return time_until_send;
|
| }
|
| - return leaky_bucket_.TimeRemaining();
|
| -}
|
| -
|
| -QuicByteCount PacedSender::AvailableWindow(
|
| - QuicByteCount available_congestion_window) {
|
| - QuicByteCount accuracy_window = pace_.ToBytesPerPeriod(
|
| - QuicTime::Delta::FromMicroseconds(kMaxSchedulingDelayUs));
|
| - QuicByteCount min_burst_window = kMinPacketBurstSize * kMaxPacketSize;
|
| - DLOG(INFO) << "Available congestion window:" << available_congestion_window
|
| - << " accuracy window:" << accuracy_window
|
| - << " min burst window:" << min_burst_window;
|
| -
|
| - // Should we limit the window to pace the data?
|
| - if (available_congestion_window > min_burst_window &&
|
| - available_congestion_window > accuracy_window) {
|
| - // Max window depends on estimated bandwidth; higher bandwidth => larger
|
| - // burst we also consider our timing accuracy. An accuracy of 1 ms will
|
| - // allow us to send up to 19.2Mbit/s with 2 packets per burst.
|
| - available_congestion_window = std::max(min_burst_window, accuracy_window);
|
| - QuicByteCount bytes_pending = leaky_bucket_.BytesPending();
|
| - if (bytes_pending > available_congestion_window) {
|
| - return 0;
|
| - }
|
| - available_congestion_window -= bytes_pending;
|
| - }
|
| - return available_congestion_window;
|
| + return leaky_bucket_.TimeRemaining(now);
|
| }
|
|
|
| } // namespace net
|
|
|