| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 // Implements Proportional Rate Reduction (PRR) per RFC 6937. | 5 // Implements Proportional Rate Reduction (PRR) per RFC 6937. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_ | 7 #ifndef NET_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_ |
| 8 #define NET_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_ | 8 #define NET_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_ |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| 11 | 11 |
| 12 #include "net/base/net_export.h" | |
| 13 #include "net/quic/core/quic_bandwidth.h" | 12 #include "net/quic/core/quic_bandwidth.h" |
| 14 #include "net/quic/core/quic_time.h" | 13 #include "net/quic/core/quic_time.h" |
| 14 #include "net/quic/platform/api/quic_export.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 class NET_EXPORT_PRIVATE PrrSender { | 18 class QUIC_EXPORT_PRIVATE PrrSender { |
| 19 public: | 19 public: |
| 20 PrrSender(); | 20 PrrSender(); |
| 21 // OnPacketLost should be called on the first loss that triggers a recovery | 21 // OnPacketLost should be called on the first loss that triggers a recovery |
| 22 // period and all other methods in this class should only be called when in | 22 // period and all other methods in this class should only be called when in |
| 23 // recovery. | 23 // recovery. |
| 24 void OnPacketLost(QuicByteCount prior_in_flight); | 24 void OnPacketLost(QuicByteCount prior_in_flight); |
| 25 void OnPacketSent(QuicByteCount sent_bytes); | 25 void OnPacketSent(QuicByteCount sent_bytes); |
| 26 void OnPacketAcked(QuicByteCount acked_bytes); | 26 void OnPacketAcked(QuicByteCount acked_bytes); |
| 27 QuicTime::Delta TimeUntilSend(QuicByteCount congestion_window, | 27 QuicTime::Delta TimeUntilSend(QuicByteCount congestion_window, |
| 28 QuicByteCount bytes_in_flight, | 28 QuicByteCount bytes_in_flight, |
| 29 QuicByteCount slowstart_threshold) const; | 29 QuicByteCount slowstart_threshold) const; |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 // Bytes sent and acked since the last loss event. | 32 // Bytes sent and acked since the last loss event. |
| 33 // |bytes_sent_since_loss_| is the same as "prr_out_" in RFC 6937, | 33 // |bytes_sent_since_loss_| is the same as "prr_out_" in RFC 6937, |
| 34 // and |bytes_delivered_since_loss_| is the same as "prr_delivered_". | 34 // and |bytes_delivered_since_loss_| is the same as "prr_delivered_". |
| 35 QuicByteCount bytes_sent_since_loss_; | 35 QuicByteCount bytes_sent_since_loss_; |
| 36 QuicByteCount bytes_delivered_since_loss_; | 36 QuicByteCount bytes_delivered_since_loss_; |
| 37 size_t ack_count_since_loss_; | 37 size_t ack_count_since_loss_; |
| 38 | 38 |
| 39 // The congestion window before the last loss event. | 39 // The congestion window before the last loss event. |
| 40 QuicByteCount bytes_in_flight_before_loss_; | 40 QuicByteCount bytes_in_flight_before_loss_; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace net | 43 } // namespace net |
| 44 | 44 |
| 45 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_ | 45 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_PRR_SENDER_H_ |
| OLD | NEW |