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 <algorithm> |
| 8 |
7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 | 11 |
| 12 using std::max; |
| 13 |
| 14 namespace net { |
| 15 |
10 namespace { | 16 namespace { |
11 const int kProbeSizePackets = 10; | 17 const int kProbeSizePackets = 10; |
12 const net::QuicByteCount kMinPacketSize = 500; | 18 const QuicByteCount kMinPacketSize = 500; |
13 const int64 kDefaultBytesPerSecond = 40000; | 19 const int64 kDefaultBytesPerSecond = 40000; |
14 const float kUncertainScaleFactor = 0.5; // TODO(pwestin): revisit this factor. | 20 const float kUncertainScaleFactor = 0.5; // TODO(pwestin): revisit this factor. |
15 } | 21 } |
16 | 22 |
17 namespace net { | |
18 | |
19 InterArrivalProbe::InterArrivalProbe(QuicByteCount max_segment_size) | 23 InterArrivalProbe::InterArrivalProbe(QuicByteCount max_segment_size) |
20 : max_segment_size_(max_segment_size), | 24 : max_segment_size_(max_segment_size), |
21 estimate_available_(false), | 25 estimate_available_(false), |
22 available_channel_estimate_(QuicBandwidth::Zero()), | 26 available_channel_estimate_(QuicBandwidth::Zero()), |
23 unacked_data_(0) { | 27 unacked_data_(0) { |
24 } | 28 } |
25 | 29 |
26 InterArrivalProbe::~InterArrivalProbe() { | 30 InterArrivalProbe::~InterArrivalProbe() { |
27 } | 31 } |
28 | 32 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 break; | 105 break; |
102 case kAvailableChannelEstimateUncertain: | 106 case kAvailableChannelEstimateUncertain: |
103 available_channel_estimate_ = | 107 available_channel_estimate_ = |
104 available_channel_estimate.Scale(kUncertainScaleFactor); | 108 available_channel_estimate.Scale(kUncertainScaleFactor); |
105 break; | 109 break; |
106 case kAvailableChannelEstimateGood: | 110 case kAvailableChannelEstimateGood: |
107 available_channel_estimate_ = available_channel_estimate; | 111 available_channel_estimate_ = available_channel_estimate; |
108 break; | 112 break; |
109 case kAvailableChannelEstimateSenderLimited: | 113 case kAvailableChannelEstimateSenderLimited: |
110 available_channel_estimate_ = | 114 available_channel_estimate_ = |
111 std::max(available_channel_estimate, | 115 max(available_channel_estimate, |
112 QuicBandwidth::FromBytesPerSecond(kDefaultBytesPerSecond)); | 116 QuicBandwidth::FromBytesPerSecond(kDefaultBytesPerSecond)); |
113 break; | 117 break; |
114 } | 118 } |
115 estimate_available_ = true; | 119 estimate_available_ = true; |
116 available_channel_estimator_.reset(NULL); | 120 available_channel_estimator_.reset(NULL); |
117 DVLOG(1) << "Probe estimate:" | 121 DVLOG(1) << "Probe estimate:" |
118 << available_channel_estimate_.ToKBitsPerSecond() | 122 << available_channel_estimate_.ToKBitsPerSecond() |
119 << " Kbits/s"; | 123 << " Kbits/s"; |
120 } | 124 } |
121 | 125 |
122 } // namespace net | 126 } // namespace net |
OLD | NEW |