| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 BandwidthUsage OveruseDetector::Detect(double offset, | 85 BandwidthUsage OveruseDetector::Detect(double offset, |
| 86 double ts_delta, | 86 double ts_delta, |
| 87 int num_of_deltas, | 87 int num_of_deltas, |
| 88 int64_t now_ms) { | 88 int64_t now_ms) { |
| 89 if (num_of_deltas < 2) { | 89 if (num_of_deltas < 2) { |
| 90 return BandwidthUsage::kBwNormal; | 90 return BandwidthUsage::kBwNormal; |
| 91 } | 91 } |
| 92 const double T = std::min(num_of_deltas, kMinNumDeltas) * offset; | 92 const double T = std::min(num_of_deltas, kMinNumDeltas) * offset; |
| 93 BWE_TEST_LOGGING_PLOT(1, "offset_ms#1", now_ms, offset); | 93 BWE_TEST_LOGGING_PLOT(1, "T", now_ms, T); |
| 94 BWE_TEST_LOGGING_PLOT(1, "gamma_ms#1", now_ms, threshold_ / kMinNumDeltas); | 94 BWE_TEST_LOGGING_PLOT(1, "threshold", now_ms, threshold_); |
| 95 if (T > threshold_) { | 95 if (T > threshold_) { |
| 96 if (time_over_using_ == -1) { | 96 if (time_over_using_ == -1) { |
| 97 // Initialize the timer. Assume that we've been | 97 // Initialize the timer. Assume that we've been |
| 98 // over-using half of the time since the previous | 98 // over-using half of the time since the previous |
| 99 // sample. | 99 // sample. |
| 100 time_over_using_ = ts_delta / 2; | 100 time_over_using_ = ts_delta / 2; |
| 101 } else { | 101 } else { |
| 102 // Increment timer | 102 // Increment timer |
| 103 time_over_using_ += ts_delta; | 103 time_over_using_ += ts_delta; |
| 104 } | 104 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 RTC_DCHECK(in_experiment_); | 153 RTC_DCHECK(in_experiment_); |
| 154 double k_up = 0.0; | 154 double k_up = 0.0; |
| 155 double k_down = 0.0; | 155 double k_down = 0.0; |
| 156 overusing_time_threshold_ = kOverUsingTimeThreshold; | 156 overusing_time_threshold_ = kOverUsingTimeThreshold; |
| 157 if (ReadExperimentConstants(&k_up, &k_down)) { | 157 if (ReadExperimentConstants(&k_up, &k_down)) { |
| 158 k_up_ = k_up; | 158 k_up_ = k_up; |
| 159 k_down_ = k_down; | 159 k_down_ = k_down; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 } // namespace webrtc | 162 } // namespace webrtc |
| OLD | NEW |