OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 BWE_TEST_LOGGING_PLOT(1, "km", now_ms, K[1]); | 122 BWE_TEST_LOGGING_PLOT(1, "km", now_ms, K[1]); |
123 BWE_TEST_LOGGING_PLOT(1, "slope_1/bps", now_ms, slope_); | 123 BWE_TEST_LOGGING_PLOT(1, "slope_1/bps", now_ms, slope_); |
124 BWE_TEST_LOGGING_PLOT(1, "var_noise", now_ms, var_noise_); | 124 BWE_TEST_LOGGING_PLOT(1, "var_noise", now_ms, var_noise_); |
125 } | 125 } |
126 | 126 |
127 double OveruseEstimator::UpdateMinFramePeriod(double ts_delta) { | 127 double OveruseEstimator::UpdateMinFramePeriod(double ts_delta) { |
128 double min_frame_period = ts_delta; | 128 double min_frame_period = ts_delta; |
129 if (ts_delta_hist_.size() >= kMinFramePeriodHistoryLength) { | 129 if (ts_delta_hist_.size() >= kMinFramePeriodHistoryLength) { |
130 ts_delta_hist_.pop_front(); | 130 ts_delta_hist_.pop_front(); |
131 } | 131 } |
132 std::list<double>::iterator it = ts_delta_hist_.begin(); | 132 for (const double old_ts_delta : ts_delta_hist_) { |
133 for (; it != ts_delta_hist_.end(); it++) { | 133 min_frame_period = std::min(old_ts_delta, min_frame_period); |
134 min_frame_period = std::min(*it, min_frame_period); | |
135 } | 134 } |
136 ts_delta_hist_.push_back(ts_delta); | 135 ts_delta_hist_.push_back(ts_delta); |
137 return min_frame_period; | 136 return min_frame_period; |
138 } | 137 } |
139 | 138 |
140 void OveruseEstimator::UpdateNoiseEstimate(double residual, | 139 void OveruseEstimator::UpdateNoiseEstimate(double residual, |
141 double ts_delta, | 140 double ts_delta, |
142 bool stable_state) { | 141 bool stable_state) { |
143 if (!stable_state) { | 142 if (!stable_state) { |
144 return; | 143 return; |
(...skipping 10 matching lines...) Expand all Loading... |
155 const double beta = pow(1 - alpha, ts_delta * 30.0 / 1000.0); | 154 const double beta = pow(1 - alpha, ts_delta * 30.0 / 1000.0); |
156 avg_noise_ = beta * avg_noise_ | 155 avg_noise_ = beta * avg_noise_ |
157 + (1 - beta) * residual; | 156 + (1 - beta) * residual; |
158 var_noise_ = beta * var_noise_ | 157 var_noise_ = beta * var_noise_ |
159 + (1 - beta) * (avg_noise_ - residual) * (avg_noise_ - residual); | 158 + (1 - beta) * (avg_noise_ - residual) * (avg_noise_ - residual); |
160 if (var_noise_ < 1) { | 159 if (var_noise_ < 1) { |
161 var_noise_ = 1; | 160 var_noise_ = 1; |
162 } | 161 } |
163 } | 162 } |
164 } // namespace webrtc | 163 } // namespace webrtc |
OLD | NEW |