| 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 | #ifndef MODULES_PACING_INTERVAL_BUDGET_H_ |
| 12 | #define MODULES_PACING_INTERVAL_BUDGET_H_ |
| 13 |
| 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
| 16 |
| 17 | namespace webrtc { |
| 18 |
| 19 | // TODO(tschumim): Reflector IntervalBudget so that we can set a under- and |
| 20 | // over-use budget in ms. |
| 21 | class IntervalBudget { |
| 22 | public: |
| 23 | explicit IntervalBudget(int initial_target_rate_kbps); |
| 24 | IntervalBudget(int initial_target_rate_kbps, bool can_build_up_underuse); |
| 25 | void set_target_rate_kbps(int target_rate_kbps); |
| 26 |
| 27 | // TODO(tschumim): Unify IncreaseBudget and UseBudget to one function. |
| 28 | void IncreaseBudget(int64_t delta_time_ms); |
| 29 | void UseBudget(size_t bytes); |
| 30 |
| 31 | size_t bytes_remaining() const; |
| 32 | double budget_ratio() const; |
| 33 | int target_rate_kbps() const; |
| 34 |
| 35 | private: |
| 36 | int target_rate_kbps_; |
| 37 | int64_t max_bytes_in_budget_; |
| 38 | int64_t bytes_remaining_; |
| 39 | bool can_build_up_underuse_; |
| 40 | }; |
| 41 |
| 42 | } // namespace webrtc |
| 43 |
| 44 | #endif // MODULES_PACING_INTERVAL_BUDGET_H_ |
| 45 |