blob: fe770ab43f8407be8cdef955a4b26f8eb9a4eea3 [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
11#ifndef WEBRTC_MODULES_PACING_INTERVAL_BUDGET_H_
12#define WEBRTC_MODULES_PACING_INTERVAL_BUDGET_H_
13
14#include "webrtc/common_types.h"
15
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
43#endif // WEBRTC_MODULES_PACING_INTERVAL_BUDGET_H_