Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 last_update_ms_ = now_ms; | 135 last_update_ms_ = now_ms; |
| 136 | 136 |
| 137 if (fabs(modified_offset) > threshold_ + kMaxAdaptOffsetMs) { | 137 if (fabs(modified_offset) > threshold_ + kMaxAdaptOffsetMs) { |
| 138 // Avoid adapting the threshold to big latency spikes, caused e.g., | 138 // Avoid adapting the threshold to big latency spikes, caused e.g., |
| 139 // by a sudden capacity drop. | 139 // by a sudden capacity drop. |
| 140 last_update_ms_ = now_ms; | 140 last_update_ms_ = now_ms; |
| 141 return; | 141 return; |
| 142 } | 142 } |
| 143 | 143 |
| 144 const double k = fabs(modified_offset) < threshold_ ? k_down_ : k_up_; | 144 const double k = fabs(modified_offset) < threshold_ ? k_down_ : k_up_; |
| 145 const int64_t kMaxTimeDeltaMs = 100; | |
|
stefan-webrtc
2016/03/10 11:34:41
This was caught by the existing tests:
TestShortTi
mflodman
2016/03/10 11:59:33
Good catch!
mflodman
2016/03/10 11:59:33
After discussions, I agree that 100 is a good thre
| |
| 146 int64_t time_delta_ms = std::min(now_ms - last_update_ms_, kMaxTimeDeltaMs); | |
| 145 threshold_ += | 147 threshold_ += |
| 146 k * (fabs(modified_offset) - threshold_) * (now_ms - last_update_ms_); | 148 k * (fabs(modified_offset) - threshold_) * time_delta_ms; |
| 147 | 149 |
| 148 const double kMinThreshold = 6; | 150 const double kMinThreshold = 6; |
| 149 const double kMaxThreshold = 600; | 151 const double kMaxThreshold = 600; |
| 150 threshold_ = std::min(std::max(threshold_, kMinThreshold), kMaxThreshold); | 152 threshold_ = std::min(std::max(threshold_, kMinThreshold), kMaxThreshold); |
| 151 | 153 |
| 152 last_update_ms_ = now_ms; | 154 last_update_ms_ = now_ms; |
| 153 } | 155 } |
| 154 | 156 |
| 155 void OveruseDetector::InitializeExperiment() { | 157 void OveruseDetector::InitializeExperiment() { |
| 156 RTC_DCHECK(in_experiment_); | 158 RTC_DCHECK(in_experiment_); |
| 157 double k_up = 0.0; | 159 double k_up = 0.0; |
| 158 double k_down = 0.0; | 160 double k_down = 0.0; |
| 159 overusing_time_threshold_ = kOverUsingTimeThreshold; | 161 overusing_time_threshold_ = kOverUsingTimeThreshold; |
| 160 if (ReadExperimentConstants(&k_up, &k_down)) { | 162 if (ReadExperimentConstants(&k_up, &k_down)) { |
| 161 k_up_ = k_up; | 163 k_up_ = k_up; |
| 162 k_down_ = k_down; | 164 k_down_ = k_down; |
| 163 } | 165 } |
| 164 } | 166 } |
| 165 } // namespace webrtc | 167 } // namespace webrtc |
| OLD | NEW |