Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/remote_bitrate_estimator/remote_rate_control.h @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 2.9 KB
Line 
1/*
2 *  Copyright (c) 2012 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_RTP_RTCP_SOURCE_REMOTE_RATE_CONTROL_H_
12#define WEBRTC_MODULES_RTP_RTCP_SOURCE_REMOTE_RATE_CONTROL_H_
13
14#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
15
16namespace webrtc {
17
18class RemoteRateControl {
19 public:
20  RemoteRateControl();
21  ~RemoteRateControl() {}
22
23  void Reset();
24
25  // Returns true if there is a valid estimate of the incoming bitrate, false
26  // otherwise.
27  bool ValidEstimate() const;
28
29  // Returns true if the bitrate estimate hasn't been changed for more than
30  // an RTT, or if the incoming_bitrate is more than 5% above the current
31  // estimate. Should be used to decide if we should reduce the rate further
32  // when over-using.
33  bool TimeToReduceFurther(int64_t time_now,
34                           unsigned int incoming_bitrate) const;
35
36  int32_t SetConfiguredBitRates(uint32_t min_bit_rate, uint32_t max_bit_rate);
37  uint32_t LatestEstimate() const;
38  uint32_t UpdateBandwidthEstimate(int64_t now_ms);
39  void SetRtt(unsigned int rtt);
40  RateControlRegion Update(const RateControlInput* input, int64_t now_ms);
41
42 private:
43  uint32_t ChangeBitRate(uint32_t current_bit_rate,
44                         uint32_t incoming_bit_rate,
45                         double delay_factor,
46                         int64_t now_ms);
47  double RateIncreaseFactor(int64_t now_ms,
48                            int64_t last_ms,
49                            uint32_t reaction_time_ms,
50                            double noise_var) const;
51  void UpdateChangePeriod(int64_t now_ms);
52  void UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps);
53  void ChangeState(const RateControlInput& input, int64_t now_ms);
54  void ChangeState(RateControlState new_state);
55  void ChangeRegion(RateControlRegion region);
56  static void StateStr(RateControlState state, char* str);
57  static void StateStr(BandwidthUsage state, char* str);
58
59  uint32_t min_configured_bit_rate_;
60  uint32_t max_configured_bit_rate_;
61  uint32_t current_bit_rate_;
62  uint32_t max_hold_rate_;
63  float avg_max_bit_rate_;
64  float var_max_bit_rate_;
65  RateControlState rate_control_state_;
66  RateControlState came_from_state_;
67  RateControlRegion rate_control_region_;
68  int64_t last_bit_rate_change_;
69  RateControlInput current_input_;
70  bool updated_;
71  int64_t time_first_incoming_estimate_;
72  bool initialized_bit_rate_;
73  float avg_change_period_;
74  int64_t last_change_ms_;
75  float beta_;
76  unsigned int rtt_;
77};
78}  // namespace webrtc
79
80#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_REMOTE_RATE_CONTROL_H_
Note: See TracBrowser for help on using the repository browser.