tschumim | 82c5593 | 2017-07-11 06:56:04 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_PACING_INTERVAL_BUDGET_H_ |
| 12 | #define MODULES_PACING_INTERVAL_BUDGET_H_ |
tschumim | 82c5593 | 2017-07-11 06:56:04 -0700 | [diff] [blame] | 13 | |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame] | 14 | #include "common_types.h" // NOLINT(build/include) |
tschumim | 82c5593 | 2017-07-11 06:56:04 -0700 | [diff] [blame] | 15 | |
| 16 | namespace webrtc { |
| 17 | |
| 18 | // TODO(tschumim): Reflector IntervalBudget so that we can set a under- and |
| 19 | // over-use budget in ms. |
| 20 | class IntervalBudget { |
| 21 | public: |
| 22 | explicit IntervalBudget(int initial_target_rate_kbps); |
| 23 | IntervalBudget(int initial_target_rate_kbps, bool can_build_up_underuse); |
| 24 | void set_target_rate_kbps(int target_rate_kbps); |
| 25 | |
| 26 | // TODO(tschumim): Unify IncreaseBudget and UseBudget to one function. |
| 27 | void IncreaseBudget(int64_t delta_time_ms); |
| 28 | void UseBudget(size_t bytes); |
| 29 | |
| 30 | size_t bytes_remaining() const; |
| 31 | int budget_level_percent() const; |
| 32 | int target_rate_kbps() const; |
| 33 | |
| 34 | private: |
| 35 | int target_rate_kbps_; |
| 36 | int max_bytes_in_budget_; |
| 37 | int bytes_remaining_; |
| 38 | bool can_build_up_underuse_; |
| 39 | }; |
| 40 | |
| 41 | } // namespace webrtc |
| 42 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 43 | #endif // MODULES_PACING_INTERVAL_BUDGET_H_ |