OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2014 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_REMOTE_BITRATE_ESTIMATOR_MIMD_RATE_CONTROL_H_ | |
12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_MIMD_RATE_CONTROL_H_ | |
13 | |
14 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | |
15 #include "webrtc/modules/remote_bitrate_estimator/remote_rate_control.h" | |
16 | |
17 namespace webrtc { | |
18 | |
19 // A RemoteRateControl implementation based on multiplicative increases of | |
20 // bitrate when no over-use is detected and multiplicative decreases when | |
21 // over-uses are detected. | |
22 class MimdRateControl : public RemoteRateControl { | |
23 public: | |
24 explicit MimdRateControl(uint32_t min_bitrate_bps); | |
25 virtual ~MimdRateControl() {} | |
26 | |
27 // Implements RemoteRateControl. | |
28 RateControlType GetControlType() const override; | |
29 uint32_t GetMinBitrate() const override; | |
30 bool ValidEstimate() const override; | |
31 int64_t GetFeedbackInterval() const override; | |
32 bool TimeToReduceFurther(int64_t time_now, | |
33 uint32_t incoming_bitrate_bps) const override; | |
34 uint32_t LatestEstimate() const override; | |
35 uint32_t UpdateBandwidthEstimate(int64_t now_ms) override; | |
36 void SetRtt(int64_t rtt) override; | |
37 RateControlRegion Update(const RateControlInput* input, | |
38 int64_t now_ms) override; | |
39 void SetEstimate(int bitrate_bps, int64_t now_ms) override; | |
40 | |
41 private: | |
42 uint32_t ChangeBitRate(uint32_t current_bit_rate, | |
43 uint32_t incoming_bit_rate, | |
44 double delay_factor, | |
45 int64_t now_ms); | |
46 double RateIncreaseFactor(int64_t now_ms, | |
47 int64_t last_ms, | |
48 int64_t reaction_time_ms, | |
49 double noise_var) const; | |
50 void UpdateChangePeriod(int64_t now_ms); | |
51 void UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps); | |
52 void ChangeState(const RateControlInput& input, int64_t now_ms); | |
53 void ChangeState(RateControlState new_state); | |
54 void ChangeRegion(RateControlRegion region); | |
55 | |
56 uint32_t min_configured_bit_rate_; | |
57 uint32_t max_configured_bit_rate_; | |
58 uint32_t current_bit_rate_; | |
59 uint32_t max_hold_rate_; | |
60 float avg_max_bit_rate_; | |
61 float var_max_bit_rate_; | |
62 RateControlState rate_control_state_; | |
63 RateControlState came_from_state_; | |
64 RateControlRegion rate_control_region_; | |
65 int64_t last_bit_rate_change_; | |
66 RateControlInput current_input_; | |
67 bool updated_; | |
68 int64_t time_first_incoming_estimate_; | |
69 bool initialized_bit_rate_; | |
70 float avg_change_period_; | |
71 int64_t last_change_ms_; | |
72 float beta_; | |
73 int64_t rtt_; | |
74 int64_t time_of_last_log_; | |
75 | |
76 DISALLOW_IMPLICIT_CONSTRUCTORS(MimdRateControl); | |
77 }; | |
78 } // namespace webrtc | |
79 | |
80 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_MIMD_RATE_CONTROL_H_ | |
OLD | NEW |