| 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 18 matching lines...) Expand all  Loading... | 
| 29 namespace webrtc { | 29 namespace webrtc { | 
| 30 | 30 | 
| 31 const char kAdaptiveThresholdExperiment[] = "WebRTC-AdaptiveBweThreshold"; | 31 const char kAdaptiveThresholdExperiment[] = "WebRTC-AdaptiveBweThreshold"; | 
| 32 const char kEnabledPrefix[] = "Enabled"; | 32 const char kEnabledPrefix[] = "Enabled"; | 
| 33 const size_t kEnabledPrefixLength = sizeof(kEnabledPrefix) - 1; | 33 const size_t kEnabledPrefixLength = sizeof(kEnabledPrefix) - 1; | 
| 34 const char kDisabledPrefix[] = "Disabled"; | 34 const char kDisabledPrefix[] = "Disabled"; | 
| 35 const size_t kDisabledPrefixLength = sizeof(kDisabledPrefix) - 1; | 35 const size_t kDisabledPrefixLength = sizeof(kDisabledPrefix) - 1; | 
| 36 | 36 | 
| 37 const double kMaxAdaptOffsetMs = 15.0; | 37 const double kMaxAdaptOffsetMs = 15.0; | 
| 38 const double kOverUsingTimeThreshold = 10; | 38 const double kOverUsingTimeThreshold = 10; | 
|  | 39 const int kMinNumDeltas = 60; | 
| 39 | 40 | 
| 40 bool AdaptiveThresholdExperimentIsDisabled() { | 41 bool AdaptiveThresholdExperimentIsDisabled() { | 
| 41   std::string experiment_string = | 42   std::string experiment_string = | 
| 42       webrtc::field_trial::FindFullName(kAdaptiveThresholdExperiment); | 43       webrtc::field_trial::FindFullName(kAdaptiveThresholdExperiment); | 
| 43   const size_t kMinExperimentLength = kDisabledPrefixLength; | 44   const size_t kMinExperimentLength = kDisabledPrefixLength; | 
| 44   if (experiment_string.length() < kMinExperimentLength) | 45   if (experiment_string.length() < kMinExperimentLength) | 
| 45     return false; | 46     return false; | 
| 46   return experiment_string.substr(0, kDisabledPrefixLength) == kDisabledPrefix; | 47   return experiment_string.substr(0, kDisabledPrefixLength) == kDisabledPrefix; | 
| 47 } | 48 } | 
| 48 | 49 | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 85 | 86 | 
| 86 BandwidthUsage OveruseDetector::Detect(double offset, | 87 BandwidthUsage OveruseDetector::Detect(double offset, | 
| 87                                        double ts_delta, | 88                                        double ts_delta, | 
| 88                                        int num_of_deltas, | 89                                        int num_of_deltas, | 
| 89                                        int64_t now_ms) { | 90                                        int64_t now_ms) { | 
| 90   if (num_of_deltas < 2) { | 91   if (num_of_deltas < 2) { | 
| 91     return kBwNormal; | 92     return kBwNormal; | 
| 92   } | 93   } | 
| 93   const double prev_offset = prev_offset_; | 94   const double prev_offset = prev_offset_; | 
| 94   prev_offset_ = offset; | 95   prev_offset_ = offset; | 
| 95   const double T = std::min(num_of_deltas, 60) * offset; | 96   const double T = std::min(num_of_deltas, kMinNumDeltas) * offset; | 
| 96   BWE_TEST_LOGGING_PLOT(1, "offset", now_ms, T); | 97   BWE_TEST_LOGGING_PLOT(1, "offset[ms]", now_ms, offset); | 
| 97   BWE_TEST_LOGGING_PLOT(1, "threshold", now_ms, threshold_); | 98   BWE_TEST_LOGGING_PLOT(1, "gamma[ms]", now_ms, threshold_ / kMinNumDeltas); | 
| 98   if (T > threshold_) { | 99   if (T > threshold_) { | 
| 99     if (time_over_using_ == -1) { | 100     if (time_over_using_ == -1) { | 
| 100       // Initialize the timer. Assume that we've been | 101       // Initialize the timer. Assume that we've been | 
| 101       // over-using half of the time since the previous | 102       // over-using half of the time since the previous | 
| 102       // sample. | 103       // sample. | 
| 103       time_over_using_ = ts_delta / 2; | 104       time_over_using_ = ts_delta / 2; | 
| 104     } else { | 105     } else { | 
| 105       // Increment timer | 106       // Increment timer | 
| 106       time_over_using_ += ts_delta; | 107       time_over_using_ += ts_delta; | 
| 107     } | 108     } | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 159   RTC_DCHECK(in_experiment_); | 160   RTC_DCHECK(in_experiment_); | 
| 160   double k_up = 0.0; | 161   double k_up = 0.0; | 
| 161   double k_down = 0.0; | 162   double k_down = 0.0; | 
| 162   overusing_time_threshold_ = kOverUsingTimeThreshold; | 163   overusing_time_threshold_ = kOverUsingTimeThreshold; | 
| 163   if (ReadExperimentConstants(&k_up, &k_down)) { | 164   if (ReadExperimentConstants(&k_up, &k_down)) { | 
| 164     k_up_ = k_up; | 165     k_up_ = k_up; | 
| 165     k_down_ = k_down; | 166     k_down_ = k_down; | 
| 166   } | 167   } | 
| 167 } | 168 } | 
| 168 }  // namespace webrtc | 169 }  // namespace webrtc | 
| OLD | NEW | 
|---|