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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Gets thresholds from the experiment name following the format | 44 // Gets thresholds from the experiment name following the format |
45 // "WebRTC-AdaptiveBweThreshold/Enabled-0.5,0.002/". | 45 // "WebRTC-AdaptiveBweThreshold/Enabled-0.5,0.002/". |
46 bool ReadExperimentConstants(double* k_up, double* k_down) { | 46 bool ReadExperimentConstants(double* k_up, double* k_down) { |
47 std::string experiment_string = | 47 std::string experiment_string = |
48 webrtc::field_trial::FindFullName(kAdaptiveThresholdExperiment); | 48 webrtc::field_trial::FindFullName(kAdaptiveThresholdExperiment); |
49 return sscanf(experiment_string.substr(kEnabledPrefixLength + 1).c_str(), | 49 return sscanf(experiment_string.substr(kEnabledPrefixLength + 1).c_str(), |
50 "%lf,%lf", k_up, k_down) == 2; | 50 "%lf,%lf", k_up, k_down) == 2; |
51 } | 51 } |
52 | 52 |
53 OveruseDetector::OveruseDetector() | 53 OveruseDetector::OveruseDetector(const OverUseDetectorOptions& options) |
54 : in_experiment_(AdaptiveThresholdExperimentIsEnabled()), | 54 : in_experiment_(AdaptiveThresholdExperimentIsEnabled()), |
55 k_up_(0.01), | 55 k_up_(0.01), |
56 k_down_(0.00018), | 56 k_down_(0.00018), |
57 overusing_time_threshold_(100), | 57 overusing_time_threshold_(100), |
| 58 options_(options), |
58 threshold_(12.5), | 59 threshold_(12.5), |
59 last_update_ms_(-1), | 60 last_update_ms_(-1), |
60 prev_offset_(0.0), | 61 prev_offset_(0.0), |
61 time_over_using_(-1), | 62 time_over_using_(-1), |
62 overuse_counter_(0), | 63 overuse_counter_(0), |
63 hypothesis_(kBwNormal) { | 64 hypothesis_(kBwNormal) { |
64 if (in_experiment_) | 65 if (in_experiment_) |
65 InitializeExperiment(); | 66 InitializeExperiment(); |
66 } | 67 } |
67 | 68 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 RTC_DCHECK(in_experiment_); | 146 RTC_DCHECK(in_experiment_); |
146 double k_up = 0.0; | 147 double k_up = 0.0; |
147 double k_down = 0.0; | 148 double k_down = 0.0; |
148 overusing_time_threshold_ = kOverUsingTimeThreshold; | 149 overusing_time_threshold_ = kOverUsingTimeThreshold; |
149 if (ReadExperimentConstants(&k_up, &k_down)) { | 150 if (ReadExperimentConstants(&k_up, &k_down)) { |
150 k_up_ = k_up; | 151 k_up_ = k_up; |
151 k_down_ = k_down; | 152 k_down_ = k_down; |
152 } | 153 } |
153 } | 154 } |
154 } // namespace webrtc | 155 } // namespace webrtc |
OLD | NEW |