| 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 |
| 11 #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" |
| 12 | 12 |
| 13 #include <math.h> | 13 #include <math.h> |
| 14 #include <stdlib.h> | 14 #include <stdlib.h> |
| 15 | 15 |
| 16 #include <algorithm> | 16 #include <algorithm> |
| 17 #include <sstream> | 17 #include <sstream> |
| 18 #include <string> | 18 #include <string> |
| 19 | 19 |
| 20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
| 21 #include "webrtc/base/common.h" | 21 #include "webrtc/base/common.h" |
| 22 #include "webrtc/base/logging.h" |
| 22 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
| 23 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" | 24 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" |
| 24 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 25 #include "webrtc/system_wrappers/include/field_trial.h" | 26 #include "webrtc/system_wrappers/include/field_trial.h" |
| 26 #include "webrtc/system_wrappers/include/trace.h" | 27 #include "webrtc/system_wrappers/include/trace.h" |
| 27 | 28 |
| 28 namespace webrtc { | 29 namespace webrtc { |
| 29 | 30 |
| 30 const char kAdaptiveThresholdExperiment[] = "WebRTC-AdaptiveBweThreshold"; | 31 const char kAdaptiveThresholdExperiment[] = "WebRTC-AdaptiveBweThreshold"; |
| 31 const char kEnabledPrefix[] = "Enabled"; | 32 const char kEnabledPrefix[] = "Enabled"; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 webrtc::field_trial::FindFullName(kAdaptiveThresholdExperiment); | 53 webrtc::field_trial::FindFullName(kAdaptiveThresholdExperiment); |
| 53 const size_t kMinExperimentLength = kEnabledPrefixLength + 3; | 54 const size_t kMinExperimentLength = kEnabledPrefixLength + 3; |
| 54 if (experiment_string.length() < kMinExperimentLength || | 55 if (experiment_string.length() < kMinExperimentLength || |
| 55 experiment_string.substr(0, kEnabledPrefixLength) != kEnabledPrefix) | 56 experiment_string.substr(0, kEnabledPrefixLength) != kEnabledPrefix) |
| 56 return false; | 57 return false; |
| 57 return sscanf(experiment_string.substr(kEnabledPrefixLength + 1).c_str(), | 58 return sscanf(experiment_string.substr(kEnabledPrefixLength + 1).c_str(), |
| 58 "%lf,%lf", k_up, k_down) == 2; | 59 "%lf,%lf", k_up, k_down) == 2; |
| 59 } | 60 } |
| 60 | 61 |
| 61 OveruseDetector::OveruseDetector(const OverUseDetectorOptions& options) | 62 OveruseDetector::OveruseDetector(const OverUseDetectorOptions& options) |
| 62 // Experiment is on by default, but can be disabled with finch by setting | 63 // Experiment is on by default, but can be disabled with finch by setting |
| 63 // the field trial string to "WebRTC-AdaptiveBweThreshold/Disabled/". | 64 // the field trial string to "WebRTC-AdaptiveBweThreshold/Disabled/". |
| 64 : in_experiment_(!AdaptiveThresholdExperimentIsDisabled()), | 65 : in_experiment_(!AdaptiveThresholdExperimentIsDisabled()), |
| 65 k_up_(0.004), | 66 k_up_(0.0087), |
| 66 k_down_(0.00006), | 67 k_down_(0.039), |
| 67 overusing_time_threshold_(100), | 68 overusing_time_threshold_(100), |
| 68 options_(options), | 69 options_(options), |
| 69 threshold_(12.5), | 70 threshold_(12.5), |
| 70 last_update_ms_(-1), | 71 last_update_ms_(-1), |
| 71 prev_offset_(0.0), | 72 prev_offset_(0.0), |
| 72 time_over_using_(-1), | 73 time_over_using_(-1), |
| 73 overuse_counter_(0), | 74 overuse_counter_(0), |
| 74 hypothesis_(kBwNormal) { | 75 hypothesis_(kBwNormal) { |
| 75 if (!AdaptiveThresholdExperimentIsDisabled()) | 76 if (!AdaptiveThresholdExperimentIsDisabled()) |
| 76 InitializeExperiment(); | 77 InitializeExperiment(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 RTC_DCHECK(in_experiment_); | 159 RTC_DCHECK(in_experiment_); |
| 159 double k_up = 0.0; | 160 double k_up = 0.0; |
| 160 double k_down = 0.0; | 161 double k_down = 0.0; |
| 161 overusing_time_threshold_ = kOverUsingTimeThreshold; | 162 overusing_time_threshold_ = kOverUsingTimeThreshold; |
| 162 if (ReadExperimentConstants(&k_up, &k_down)) { | 163 if (ReadExperimentConstants(&k_up, &k_down)) { |
| 163 k_up_ = k_up; | 164 k_up_ = k_up; |
| 164 k_down_ = k_down; | 165 k_down_ = k_down; |
| 165 } | 166 } |
| 166 } | 167 } |
| 167 } // namespace webrtc | 168 } // namespace webrtc |
| OLD | NEW |