OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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/pacing/interval_budget.h" | 11 #include "webrtc/modules/pacing/interval_budget.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 namespace webrtc { | 15 namespace webrtc { |
16 namespace { | 16 namespace { |
17 constexpr int kWindowMs = 500; | 17 constexpr int kWindowMs = 250; |
18 constexpr int kDeltaTimeMs = 2000; | 18 constexpr int kDeltaTimeMs = 2000; |
19 } | 19 } |
20 | 20 |
21 IntervalBudget::IntervalBudget(int initial_target_rate_kbps) | 21 IntervalBudget::IntervalBudget(int initial_target_rate_kbps) |
22 : IntervalBudget(initial_target_rate_kbps, false) {} | 22 : IntervalBudget(initial_target_rate_kbps, false) {} |
23 | 23 |
24 IntervalBudget::IntervalBudget(int initial_target_rate_kbps, | 24 IntervalBudget::IntervalBudget(int initial_target_rate_kbps, |
25 bool can_build_up_underuse) | 25 bool can_build_up_underuse) |
26 : bytes_remaining_(0), can_build_up_underuse_(can_build_up_underuse) { | 26 : bytes_remaining_(0), can_build_up_underuse_(can_build_up_underuse) { |
27 set_target_rate_kbps(initial_target_rate_kbps); | 27 set_target_rate_kbps(initial_target_rate_kbps); |
(...skipping 29 matching lines...) Expand all Loading... |
57 | 57 |
58 int IntervalBudget::budget_level_percent() const { | 58 int IntervalBudget::budget_level_percent() const { |
59 return bytes_remaining_ * 100 / max_bytes_in_budget_; | 59 return bytes_remaining_ * 100 / max_bytes_in_budget_; |
60 } | 60 } |
61 | 61 |
62 int IntervalBudget::target_rate_kbps() const { | 62 int IntervalBudget::target_rate_kbps() const { |
63 return target_rate_kbps_; | 63 return target_rate_kbps_; |
64 } | 64 } |
65 | 65 |
66 } // namespace webrtc | 66 } // namespace webrtc |
OLD | NEW |