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(const OverUseDetectorOptions& options) | 53 OveruseDetector::OveruseDetector() |
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), | |
59 threshold_(12.5), | 58 threshold_(12.5), |
60 last_update_ms_(-1), | 59 last_update_ms_(-1), |
61 prev_offset_(0.0), | 60 prev_offset_(0.0), |
62 time_over_using_(-1), | 61 time_over_using_(-1), |
63 overuse_counter_(0), | 62 overuse_counter_(0), |
64 hypothesis_(kBwNormal) { | 63 hypothesis_(kBwNormal) { |
65 if (in_experiment_) | 64 if (in_experiment_) |
66 InitializeExperiment(); | 65 InitializeExperiment(); |
67 } | 66 } |
68 | 67 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 RTC_DCHECK(in_experiment_); | 145 RTC_DCHECK(in_experiment_); |
147 double k_up = 0.0; | 146 double k_up = 0.0; |
148 double k_down = 0.0; | 147 double k_down = 0.0; |
149 overusing_time_threshold_ = kOverUsingTimeThreshold; | 148 overusing_time_threshold_ = kOverUsingTimeThreshold; |
150 if (ReadExperimentConstants(&k_up, &k_down)) { | 149 if (ReadExperimentConstants(&k_up, &k_down)) { |
151 k_up_ = k_up; | 150 k_up_ = k_up; |
152 k_down_ = k_down; | 151 k_down_ = k_down; |
153 } | 152 } |
154 } | 153 } |
155 } // namespace webrtc | 154 } // namespace webrtc |
OLD | NEW |