OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 * |
| 10 */ |
| 11 |
| 12 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_
filter.h" |
| 13 |
| 14 namespace webrtc { |
| 15 namespace testing { |
| 16 namespace bwe { |
| 17 MaxBandwidthFilter::MaxBandwidthFilter() {} |
| 18 |
| 19 MaxBandwidthFilter::~MaxBandwidthFilter() {} |
| 20 |
| 21 bool MaxBandwidthFilter::FullBandwidthReached(float growth_target, |
| 22 int max_rounds_without_growth) { |
| 23 // Minimal bandwidth necessary to assume that better bandwidth can still be |
| 24 // found and full bandwidth is not reached. |
| 25 int64_t minimal_bandwidth = bandwidth_last_round_ * growth_target; |
| 26 if (max_bandwidth_estimate_ >= minimal_bandwidth) { |
| 27 bandwidth_last_round_ = max_bandwidth_estimate_; |
| 28 rounds_without_growth_ = 0; |
| 29 return false; |
| 30 } |
| 31 rounds_without_growth_++; |
| 32 if (rounds_without_growth_ >= max_rounds_without_growth) |
| 33 return true; |
| 34 return false; |
| 35 } |
| 36 } // namespace bwe |
| 37 } // namespace testing |
| 38 } // namespace webrtc |
OLD | NEW |