| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (pings_since_last_response.size() == 0) | 53 if (pings_since_last_response.size() == 0) |
| 54 return false; | 54 return false; |
| 55 | 55 |
| 56 auto first = pings_since_last_response[0]; | 56 auto first = pings_since_last_response[0]; |
| 57 return now > (first.sent_time + maximum_time); | 57 return now > (first.sent_time + maximum_time); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // We will restrict RTT estimates (when used for determining state) to be | 60 // We will restrict RTT estimates (when used for determining state) to be |
| 61 // within a reasonable range. | 61 // within a reasonable range. |
| 62 const int MINIMUM_RTT = 100; // 0.1 seconds | 62 const int MINIMUM_RTT = 100; // 0.1 seconds |
| 63 const int MAXIMUM_RTT = 3000; // 3 seconds | 63 const int MAXIMUM_RTT = 60000; // 60 seconds |
| 64 | 64 |
| 65 // When we don't have any RTT data, we have to pick something reasonable. We | 65 // When we don't have any RTT data, we have to pick something reasonable. We |
| 66 // use a large value just in case the connection is really slow. | 66 // use a large value just in case the connection is really slow. |
| 67 const int DEFAULT_RTT = MAXIMUM_RTT; | 67 const int DEFAULT_RTT = 3000; // 3 seconds |
| 68 | 68 |
| 69 // Computes our estimate of the RTT given the current estimate. | 69 // Computes our estimate of the RTT given the current estimate. |
| 70 inline int ConservativeRTTEstimate(int rtt) { | 70 inline int ConservativeRTTEstimate(int rtt) { |
| 71 return std::max(MINIMUM_RTT, std::min(MAXIMUM_RTT, 2 * rtt)); | 71 return std::max(MINIMUM_RTT, std::min(MAXIMUM_RTT, 2 * rtt)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Weighting of the old rtt value to new data. | 74 // Weighting of the old rtt value to new data. |
| 75 const int RTT_RATIO = 3; // 3 : 1 | 75 const int RTT_RATIO = 3; // 3 : 1 |
| 76 | 76 |
| 77 // The delay before we begin checking if this port is useless. | 77 // The delay before we begin checking if this port is useless. |
| (...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 RTC_DCHECK(sent < 0); | 1583 RTC_DCHECK(sent < 0); |
| 1584 error_ = port_->GetError(); | 1584 error_ = port_->GetError(); |
| 1585 stats_.sent_discarded_packets++; | 1585 stats_.sent_discarded_packets++; |
| 1586 } else { | 1586 } else { |
| 1587 send_rate_tracker_.AddSamples(sent); | 1587 send_rate_tracker_.AddSamples(sent); |
| 1588 } | 1588 } |
| 1589 return sent; | 1589 return sent; |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 } // namespace cricket | 1592 } // namespace cricket |
| OLD | NEW |