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/fix_rate_sender.h" | 5 #include "net/quic/congestion_control/fix_rate_sender.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 bytes_in_flight_ += bytes; | 58 bytes_in_flight_ += bytes; |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 QuicTime::Delta FixRateSender::TimeUntilSend(bool /*retransmit*/) { | 62 QuicTime::Delta FixRateSender::TimeUntilSend(bool /*retransmit*/) { |
63 if (CongestionWindow() > fix_rate_leaky_bucket_.BytesPending()) { | 63 if (CongestionWindow() > fix_rate_leaky_bucket_.BytesPending()) { |
64 if (CongestionWindow() <= bytes_in_flight_) { | 64 if (CongestionWindow() <= bytes_in_flight_) { |
65 // We need an ack before we send more. | 65 // We need an ack before we send more. |
66 return QuicTime::Delta::Infinite(); | 66 return QuicTime::Delta::Infinite(); |
67 } | 67 } |
68 QuicTime::Delta zero_time; | 68 QuicTime::Delta zero_time(QuicTime::Delta::Zero()); |
69 return paced_sender_.TimeUntilSend(zero_time); | 69 return paced_sender_.TimeUntilSend(zero_time); |
70 } | 70 } |
71 QuicTime::Delta time_remaining = fix_rate_leaky_bucket_.TimeRemaining(); | 71 QuicTime::Delta time_remaining = fix_rate_leaky_bucket_.TimeRemaining(); |
72 if (time_remaining.IsZero()) { | 72 if (time_remaining.IsZero()) { |
73 // We need an ack before we send more. | 73 // We need an ack before we send more. |
74 return QuicTime::Delta::Infinite(); | 74 return QuicTime::Delta::Infinite(); |
75 } | 75 } |
76 return paced_sender_.TimeUntilSend(time_remaining); | 76 return paced_sender_.TimeUntilSend(time_remaining); |
77 } | 77 } |
78 | 78 |
(...skipping 11 matching lines...) Expand all Loading... |
90 } | 90 } |
91 size_t available_congestion_window = congestion_window - bytes_in_flight_; | 91 size_t available_congestion_window = congestion_window - bytes_in_flight_; |
92 return paced_sender_.AvailableWindow(available_congestion_window); | 92 return paced_sender_.AvailableWindow(available_congestion_window); |
93 } | 93 } |
94 | 94 |
95 int FixRateSender::BandwidthEstimate() { | 95 int FixRateSender::BandwidthEstimate() { |
96 return bitrate_in_bytes_per_s_; | 96 return bitrate_in_bytes_per_s_; |
97 } | 97 } |
98 | 98 |
99 } // namespace net | 99 } // namespace net |
OLD | NEW |