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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 BandwidthUsage OveruseDetector::Detect(double offset, | 87 BandwidthUsage OveruseDetector::Detect(double offset, |
88 double ts_delta, | 88 double ts_delta, |
89 int num_of_deltas, | 89 int num_of_deltas, |
90 int64_t now_ms) { | 90 int64_t now_ms) { |
91 if (num_of_deltas < 2) { | 91 if (num_of_deltas < 2) { |
92 return kBwNormal; | 92 return kBwNormal; |
93 } | 93 } |
94 const double prev_offset = prev_offset_; | 94 const double prev_offset = prev_offset_; |
95 prev_offset_ = offset; | 95 prev_offset_ = offset; |
96 const double T = std::min(num_of_deltas, kMinNumDeltas) * offset; | 96 const double T = std::min(num_of_deltas, kMinNumDeltas) * offset; |
97 BWE_TEST_LOGGING_PLOT(1, "offset[ms]", now_ms, offset); | 97 BWE_TEST_LOGGING_PLOT(1, "offset_ms#1", now_ms, offset); |
98 BWE_TEST_LOGGING_PLOT(1, "gamma[ms]", now_ms, threshold_ / kMinNumDeltas); | 98 BWE_TEST_LOGGING_PLOT(1, "gamma_ms#1", now_ms, threshold_ / kMinNumDeltas); |
99 if (T > threshold_) { | 99 if (T > threshold_) { |
100 if (time_over_using_ == -1) { | 100 if (time_over_using_ == -1) { |
101 // Initialize the timer. Assume that we've been | 101 // Initialize the timer. Assume that we've been |
102 // over-using half of the time since the previous | 102 // over-using half of the time since the previous |
103 // sample. | 103 // sample. |
104 time_over_using_ = ts_delta / 2; | 104 time_over_using_ = ts_delta / 2; |
105 } else { | 105 } else { |
106 // Increment timer | 106 // Increment timer |
107 time_over_using_ += ts_delta; | 107 time_over_using_ += ts_delta; |
108 } | 108 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 RTC_DCHECK(in_experiment_); | 160 RTC_DCHECK(in_experiment_); |
161 double k_up = 0.0; | 161 double k_up = 0.0; |
162 double k_down = 0.0; | 162 double k_down = 0.0; |
163 overusing_time_threshold_ = kOverUsingTimeThreshold; | 163 overusing_time_threshold_ = kOverUsingTimeThreshold; |
164 if (ReadExperimentConstants(&k_up, &k_down)) { | 164 if (ReadExperimentConstants(&k_up, &k_down)) { |
165 k_up_ = k_up; | 165 k_up_ = k_up; |
166 k_down_ = k_down; | 166 k_down_ = k_down; |
167 } | 167 } |
168 } | 168 } |
169 } // namespace webrtc | 169 } // namespace webrtc |
OLD | NEW |