OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // A send algorithm that adds pacing on top of an another send algorithm. | 5 // A send algorithm that adds pacing on top of an another send algorithm. |
6 // It uses the underlying sender's pacing rate to schedule packets. | 6 // It uses the underlying sender's pacing rate to schedule packets. |
7 // It also takes into consideration the expected granularity of the underlying | 7 // It also takes into consideration the expected granularity of the underlying |
8 // alarm to ensure that alarms are not set too aggressively, and err towards | 8 // alarm to ensure that alarms are not set too aggressively, and err towards |
9 // sending packets too early instead of too late. | 9 // sending packets too early instead of too late. |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 void set_max_pacing_rate(QuicBandwidth max_pacing_rate) { | 38 void set_max_pacing_rate(QuicBandwidth max_pacing_rate) { |
39 max_pacing_rate_ = max_pacing_rate; | 39 max_pacing_rate_ = max_pacing_rate; |
40 } | 40 } |
41 | 41 |
42 void OnCongestionEvent( | 42 void OnCongestionEvent( |
43 bool rtt_updated, | 43 bool rtt_updated, |
44 QuicByteCount bytes_in_flight, | 44 QuicByteCount bytes_in_flight, |
45 QuicTime event_time, | 45 QuicTime event_time, |
46 const SendAlgorithmInterface::CongestionVector& acked_packets, | 46 const SendAlgorithmInterface::CongestionVector& acked_packets, |
47 const SendAlgorithmInterface::CongestionVector& lost_packets); | 47 const SendAlgorithmInterface::CongestionVector& lost_packets); |
| 48 |
48 bool OnPacketSent(QuicTime sent_time, | 49 bool OnPacketSent(QuicTime sent_time, |
49 QuicByteCount bytes_in_flight, | 50 QuicByteCount bytes_in_flight, |
50 QuicPacketNumber packet_number, | 51 QuicPacketNumber packet_number, |
51 QuicByteCount bytes, | 52 QuicByteCount bytes, |
52 HasRetransmittableData is_retransmittable); | 53 HasRetransmittableData is_retransmittable); |
53 QuicTime::Delta TimeUntilSend(QuicTime now, | 54 |
54 QuicByteCount bytes_in_flight) const; | 55 QuicTime::Delta TimeUntilSend(QuicTime now, QuicByteCount bytes_in_flight); |
| 56 |
55 QuicBandwidth PacingRate(QuicByteCount bytes_in_flight) const; | 57 QuicBandwidth PacingRate(QuicByteCount bytes_in_flight) const; |
56 | 58 |
57 private: | 59 private: |
58 // Underlying sender. Not owned. | 60 // Underlying sender. Not owned. |
59 SendAlgorithmInterface* sender_; | 61 SendAlgorithmInterface* sender_; |
60 // If not QuicBandidth::Zero, the maximum rate the PacingSender will use. | 62 // If not QuicBandidth::Zero, the maximum rate the PacingSender will use. |
61 QuicBandwidth max_pacing_rate_; | 63 QuicBandwidth max_pacing_rate_; |
62 | 64 |
63 // Number of unpaced packets to be sent before packets are delayed. | 65 // Number of unpaced packets to be sent before packets are delayed. |
64 uint32_t burst_tokens_; | 66 uint32_t burst_tokens_; |
65 // Send time of the last packet considered delayed. | 67 // Send time of the last packet considered delayed. |
66 QuicTime last_delayed_packet_sent_time_; | 68 QuicTime last_delayed_packet_sent_time_; |
67 QuicTime ideal_next_packet_send_time_; // When can the next packet be sent. | 69 QuicTime ideal_next_packet_send_time_; // When can the next packet be sent. |
68 mutable bool was_last_send_delayed_; // True when the last send was delayed. | 70 bool was_last_send_delayed_; // True when the last send was delayed. |
69 | 71 |
70 DISALLOW_COPY_AND_ASSIGN(PacingSender); | 72 DISALLOW_COPY_AND_ASSIGN(PacingSender); |
71 }; | 73 }; |
72 | 74 |
73 } // namespace net | 75 } // namespace net |
74 | 76 |
75 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_PACING_SENDER_H_ | 77 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_PACING_SENDER_H_ |
OLD | NEW |