| 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 #include "net/quic/congestion_control/inter_arrival_probe.h" | 5 #include "net/quic/congestion_control/inter_arrival_probe.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 void InterArrivalProbe::OnAcknowledgedPacket(QuicByteCount bytes) { | 47 void InterArrivalProbe::OnAcknowledgedPacket(QuicByteCount bytes) { |
| 48 if (!estimate_available_) { | 48 if (!estimate_available_) { |
| 49 DCHECK_LE(bytes, unacked_data_); | 49 DCHECK_LE(bytes, unacked_data_); |
| 50 unacked_data_ -= bytes; | 50 unacked_data_ -= bytes; |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 void InterArrivalProbe::OnRetransmissionTimeout() { |
| 55 if (!estimate_available_) { |
| 56 unacked_data_ = 0; |
| 57 } |
| 58 } |
| 59 |
| 54 QuicByteCount InterArrivalProbe::GetAvailableCongestionWindow() { | 60 QuicByteCount InterArrivalProbe::GetAvailableCongestionWindow() { |
| 55 if (estimate_available_) { | 61 if (estimate_available_) { |
| 56 return 0; | 62 return 0; |
| 57 } | 63 } |
| 58 return (kProbeSizePackets * max_segment_size_) - unacked_data_; | 64 return (kProbeSizePackets * max_segment_size_) - unacked_data_; |
| 59 } | 65 } |
| 60 | 66 |
| 61 void InterArrivalProbe::OnIncomingFeedback( | 67 void InterArrivalProbe::OnIncomingFeedback( |
| 62 QuicPacketSequenceNumber sequence_number, | 68 QuicPacketSequenceNumber sequence_number, |
| 63 QuicByteCount bytes_sent, | 69 QuicByteCount bytes_sent, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 break; | 119 break; |
| 114 } | 120 } |
| 115 estimate_available_ = true; | 121 estimate_available_ = true; |
| 116 available_channel_estimator_.reset(NULL); | 122 available_channel_estimator_.reset(NULL); |
| 117 DVLOG(1) << "Probe estimate:" | 123 DVLOG(1) << "Probe estimate:" |
| 118 << available_channel_estimate_.ToKBitsPerSecond() | 124 << available_channel_estimate_.ToKBitsPerSecond() |
| 119 << " Kbits/s"; | 125 << " Kbits/s"; |
| 120 } | 126 } |
| 121 | 127 |
| 122 } // namespace net | 128 } // namespace net |
| OLD | NEW |