OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/general_loss_algorithm.h" | 5 #include "net/quic/congestion_control/general_loss_algorithm.h" |
6 | 6 |
7 #include "net/quic/congestion_control/rtt_stats.h" | 7 #include "net/quic/congestion_control/rtt_stats.h" |
8 #include "net/quic/quic_bug_tracker.h" | 8 #include "net/quic/quic_bug_tracker.h" |
9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 GeneralLossAlgorithm::GeneralLossAlgorithm(LossDetectionType loss_type) | 29 GeneralLossAlgorithm::GeneralLossAlgorithm(LossDetectionType loss_type) |
30 : loss_type_(loss_type), loss_detection_timeout_(QuicTime::Zero()) {} | 30 : loss_type_(loss_type), loss_detection_timeout_(QuicTime::Zero()) {} |
31 | 31 |
32 LossDetectionType GeneralLossAlgorithm::GetLossDetectionType() const { | 32 LossDetectionType GeneralLossAlgorithm::GetLossDetectionType() const { |
33 return loss_type_; | 33 return loss_type_; |
34 } | 34 } |
35 | 35 |
36 // Uses nack counts to decide when packets are lost. | 36 // Uses nack counts to decide when packets are lost. |
37 void GeneralLossAlgorithm::DetectLosses( | 37 void GeneralLossAlgorithm::DetectLosses( |
38 const QuicUnackedPacketMap& unacked_packets, | 38 const QuicUnackedPacketMap& unacked_packets, |
39 const QuicTime& time, | 39 QuicTime time, |
40 const RttStats& rtt_stats, | 40 const RttStats& rtt_stats, |
41 SendAlgorithmInterface::CongestionVector* packets_lost) { | 41 SendAlgorithmInterface::CongestionVector* packets_lost) { |
42 const QuicPacketNumber largest_observed = unacked_packets.largest_observed(); | 42 const QuicPacketNumber largest_observed = unacked_packets.largest_observed(); |
43 loss_detection_timeout_ = QuicTime::Zero(); | 43 loss_detection_timeout_ = QuicTime::Zero(); |
44 QuicTime::Delta loss_delay = QuicTime::Delta::Max( | 44 QuicTime::Delta loss_delay = QuicTime::Delta::Max( |
45 QuicTime::Delta::FromMilliseconds(kMinLossDelayMs), | 45 QuicTime::Delta::FromMilliseconds(kMinLossDelayMs), |
46 QuicTime::Delta::Max(rtt_stats.smoothed_rtt(), rtt_stats.latest_rtt()) | 46 QuicTime::Delta::Max(rtt_stats.smoothed_rtt(), rtt_stats.latest_rtt()) |
47 .Multiply(kLossDelayMultiplier)); | 47 .Multiply(kLossDelayMultiplier)); |
48 | 48 |
49 QuicPacketNumber packet_number = unacked_packets.GetLeastUnacked(); | 49 QuicPacketNumber packet_number = unacked_packets.GetLeastUnacked(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 } | 100 } |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 QuicTime GeneralLossAlgorithm::GetLossTimeout() const { | 104 QuicTime GeneralLossAlgorithm::GetLossTimeout() const { |
105 return loss_detection_timeout_; | 105 return loss_detection_timeout_; |
106 } | 106 } |
107 | 107 |
108 } // namespace net | 108 } // namespace net |
OLD | NEW |