blob: cbc2e69d79092a0f4c446cbb284b8317352a4305 [file] [log] [blame]
Erik Språng71215642019-01-21 16:30:55 +01001/*
2 * Copyright (c) 2019 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 RTC_BASE_EXPERIMENTS_RATE_CONTROL_SETTINGS_H_
12#define RTC_BASE_EXPERIMENTS_RATE_CONTROL_SETTINGS_H_
13
14#include "absl/types/optional.h"
15#include "api/transport/webrtc_key_value_config.h"
16#include "rtc_base/experiments/field_trial_parser.h"
Erik Språngcd76eab2019-01-21 18:06:46 +010017#include "rtc_base/experiments/field_trial_units.h"
Erik Språng71215642019-01-21 16:30:55 +010018
19namespace webrtc {
20
21class RateControlSettings final {
22 public:
23 ~RateControlSettings();
24 RateControlSettings(RateControlSettings&&);
25
26 static RateControlSettings ParseFromFieldTrials();
27 static RateControlSettings ParseFromKeyValueConfig(
28 const WebRtcKeyValueConfig* const key_value_config);
29
30 // When CongestionWindowPushback is enabled, the pacer is oblivious to
31 // the congestion window. The relation between outstanding data and
32 // the congestion window affects encoder allocations directly.
33 bool UseCongestionWindow() const;
34 int64_t GetCongestionWindowAdditionalTimeMs() const;
35 bool UseCongestionWindowPushback() const;
36 uint32_t CongestionWindowMinPushbackTargetBitrateBps() const;
37
Erik Språngcd76eab2019-01-21 18:06:46 +010038 absl::optional<double> GetPacingFactor() const;
39 bool UseAlrProbing() const;
40
Erik Språng4b4266f2019-01-23 12:48:13 +010041 bool LibvpxVp8TrustedRateController() const;
42 bool LibvpxVp9TrustedRateController() const;
43
Erik Språng2c58ba12019-01-23 16:53:18 +010044 double GetSimulcastVideoHysteresisFactor() const;
45 double GetSimulcastScreenshareHysteresisFactor() const;
46
Erik Språng5118bbc2019-01-29 18:28:06 +010047 bool TriggerProbeOnMaxAllocatedBitrateChange() const;
48
Erik Språng71215642019-01-21 16:30:55 +010049 private:
50 explicit RateControlSettings(
51 const WebRtcKeyValueConfig* const key_value_config);
52
53 FieldTrialOptional<int> congestion_window_;
54 FieldTrialOptional<int> congestion_window_pushback_;
Erik Språngcd76eab2019-01-21 18:06:46 +010055 FieldTrialOptional<double> pacing_factor_;
56 FieldTrialParameter<bool> alr_probing_;
Erik Språng4b4266f2019-01-23 12:48:13 +010057 FieldTrialParameter<bool> trust_vp8_;
58 FieldTrialParameter<bool> trust_vp9_;
Erik Språng2c58ba12019-01-23 16:53:18 +010059 FieldTrialParameter<double> video_hysteresis_;
60 FieldTrialParameter<double> screenshare_hysteresis_;
Erik Språng5118bbc2019-01-29 18:28:06 +010061 FieldTrialParameter<bool> probe_max_allocation_;
Erik Språng71215642019-01-21 16:30:55 +010062};
63
64} // namespace webrtc
65
66#endif // RTC_BASE_EXPERIMENTS_RATE_CONTROL_SETTINGS_H_