OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 |
11 #include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h" | 11 #include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 // The minumum number of probes we need for a valid cluster. | 19 // The minumum number of probes we need for a valid cluster. |
20 constexpr int kMinNumProbesValidCluster = 4; | 20 constexpr int kMinNumProbesValidCluster = 4; |
21 | 21 |
22 // The maximum (receive rate)/(send rate) ratio for a valid estimate. | 22 // The maximum (receive rate)/(send rate) ratio for a valid estimate. |
23 constexpr float kValidRatio = 1.2f; | 23 constexpr float kValidRatio = 2.0f; |
24 | 24 |
25 // The maximum time period over which the cluster history is retained. | 25 // The maximum time period over which the cluster history is retained. |
26 // This is also the maximum time period beyond which a probing burst is not | 26 // This is also the maximum time period beyond which a probing burst is not |
27 // expected to last. | 27 // expected to last. |
28 constexpr int kMaxClusterHistoryMs = 1000; | 28 constexpr int kMaxClusterHistoryMs = 1000; |
29 | 29 |
30 // The maximum time interval between first and the last probe on a cluster | 30 // The maximum time interval between first and the last probe on a cluster |
31 // on the sender side as well as the receive side. | 31 // on the sender side as well as the receive side. |
32 constexpr int kMaxProbeIntervalMs = 1000; | 32 constexpr int kMaxProbeIntervalMs = 1000; |
33 } // namespace | 33 } // namespace |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { | 118 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { |
119 for (auto it = clusters_.begin(); it != clusters_.end();) { | 119 for (auto it = clusters_.begin(); it != clusters_.end();) { |
120 if (it->second.last_receive_ms < timestamp_ms) { | 120 if (it->second.last_receive_ms < timestamp_ms) { |
121 it = clusters_.erase(it); | 121 it = clusters_.erase(it); |
122 } else { | 122 } else { |
123 ++it; | 123 ++it; |
124 } | 124 } |
125 } | 125 } |
126 } | 126 } |
127 } // namespace webrtc | 127 } // namespace webrtc |
OLD | NEW |