blob: 880fe784ba74f07ee812e94dfea9cad5ef3d5ce3 [file] [log] [blame]
tschumim82c55932017-07-11 06:56:04 -07001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_PACING_INTERVAL_BUDGET_H_
12#define MODULES_PACING_INTERVAL_BUDGET_H_
tschumim82c55932017-07-11 06:56:04 -070013
Mirko Bonadei71207422017-09-15 13:58:09 +020014#include "common_types.h" // NOLINT(build/include)
tschumim82c55932017-07-11 06:56:04 -070015
16namespace webrtc {
17
18// TODO(tschumim): Reflector IntervalBudget so that we can set a under- and
19// over-use budget in ms.
20class 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 Bonadei92ea95e2017-09-15 06:47:31 +020043#endif // MODULES_PACING_INTERVAL_BUDGET_H_