Erik Språng | 7121564 | 2019-01-21 16:30:55 +0100 | [diff] [blame] | 1 | /* |
| 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" |
Rasmus Brandt | c402dbe | 2019-02-04 11:09:46 +0100 | [diff] [blame] | 16 | #include "api/video_codecs/video_codec.h" |
| 17 | #include "api/video_codecs/video_encoder_config.h" |
Erik Språng | 7121564 | 2019-01-21 16:30:55 +0100 | [diff] [blame] | 18 | #include "rtc_base/experiments/field_trial_parser.h" |
Erik Språng | cd76eab | 2019-01-21 18:06:46 +0100 | [diff] [blame] | 19 | #include "rtc_base/experiments/field_trial_units.h" |
Erik Språng | 7121564 | 2019-01-21 16:30:55 +0100 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | |
| 23 | class RateControlSettings final { |
| 24 | public: |
| 25 | ~RateControlSettings(); |
| 26 | RateControlSettings(RateControlSettings&&); |
| 27 | |
| 28 | static RateControlSettings ParseFromFieldTrials(); |
| 29 | static RateControlSettings ParseFromKeyValueConfig( |
| 30 | const WebRtcKeyValueConfig* const key_value_config); |
| 31 | |
| 32 | // When CongestionWindowPushback is enabled, the pacer is oblivious to |
| 33 | // the congestion window. The relation between outstanding data and |
| 34 | // the congestion window affects encoder allocations directly. |
| 35 | bool UseCongestionWindow() const; |
| 36 | int64_t GetCongestionWindowAdditionalTimeMs() const; |
| 37 | bool UseCongestionWindowPushback() const; |
| 38 | uint32_t CongestionWindowMinPushbackTargetBitrateBps() const; |
| 39 | |
Erik Språng | cd76eab | 2019-01-21 18:06:46 +0100 | [diff] [blame] | 40 | absl::optional<double> GetPacingFactor() const; |
| 41 | bool UseAlrProbing() const; |
| 42 | |
Erik Språng | 4b4266f | 2019-01-23 12:48:13 +0100 | [diff] [blame] | 43 | bool LibvpxVp8TrustedRateController() const; |
Erik Språng | 7f24fb9 | 2019-02-13 10:49:37 +0100 | [diff] [blame] | 44 | bool Vp8BoostBaseLayerQuality() const; |
Erik Språng | 7a3fe89 | 2019-04-15 12:22:55 +0200 | [diff] [blame] | 45 | bool Vp8DynamicRateSettings() const; |
Erik Språng | 4b4266f | 2019-01-23 12:48:13 +0100 | [diff] [blame] | 46 | bool LibvpxVp9TrustedRateController() const; |
Erik Språng | 7a3fe89 | 2019-04-15 12:22:55 +0200 | [diff] [blame] | 47 | bool Vp9DynamicRateSettings() const; |
Erik Språng | 4b4266f | 2019-01-23 12:48:13 +0100 | [diff] [blame] | 48 | |
Rasmus Brandt | c402dbe | 2019-02-04 11:09:46 +0100 | [diff] [blame] | 49 | // TODO(bugs.webrtc.org/10272): Remove one of these when we have merged |
| 50 | // VideoCodecMode and VideoEncoderConfig::ContentType. |
| 51 | double GetSimulcastHysteresisFactor(VideoCodecMode mode) const; |
| 52 | double GetSimulcastHysteresisFactor( |
| 53 | VideoEncoderConfig::ContentType content_type) const; |
Erik Språng | 2c58ba1 | 2019-01-23 16:53:18 +0100 | [diff] [blame] | 54 | |
Erik Språng | 5118bbc | 2019-01-29 18:28:06 +0100 | [diff] [blame] | 55 | bool TriggerProbeOnMaxAllocatedBitrateChange() const; |
Erik Språng | 7ca375c | 2019-02-06 16:20:17 +0100 | [diff] [blame] | 56 | bool UseEncoderBitrateAdjuster() const; |
Erik Språng | 3d11e2f | 2019-04-15 14:48:30 +0200 | [diff] [blame] | 57 | bool BitrateAdjusterCanUseNetworkHeadroom() const; |
Erik Språng | 5118bbc | 2019-01-29 18:28:06 +0100 | [diff] [blame] | 58 | |
Erik Språng | 7121564 | 2019-01-21 16:30:55 +0100 | [diff] [blame] | 59 | private: |
| 60 | explicit RateControlSettings( |
| 61 | const WebRtcKeyValueConfig* const key_value_config); |
| 62 | |
Rasmus Brandt | c402dbe | 2019-02-04 11:09:46 +0100 | [diff] [blame] | 63 | double GetSimulcastVideoHysteresisFactor() const; |
| 64 | double GetSimulcastScreenshareHysteresisFactor() const; |
| 65 | |
Erik Språng | 7121564 | 2019-01-21 16:30:55 +0100 | [diff] [blame] | 66 | FieldTrialOptional<int> congestion_window_; |
| 67 | FieldTrialOptional<int> congestion_window_pushback_; |
Erik Språng | cd76eab | 2019-01-21 18:06:46 +0100 | [diff] [blame] | 68 | FieldTrialOptional<double> pacing_factor_; |
| 69 | FieldTrialParameter<bool> alr_probing_; |
Erik Språng | 4b4266f | 2019-01-23 12:48:13 +0100 | [diff] [blame] | 70 | FieldTrialParameter<bool> trust_vp8_; |
| 71 | FieldTrialParameter<bool> trust_vp9_; |
Erik Språng | 2c58ba1 | 2019-01-23 16:53:18 +0100 | [diff] [blame] | 72 | FieldTrialParameter<double> video_hysteresis_; |
| 73 | FieldTrialParameter<double> screenshare_hysteresis_; |
Erik Språng | 5118bbc | 2019-01-29 18:28:06 +0100 | [diff] [blame] | 74 | FieldTrialParameter<bool> probe_max_allocation_; |
Erik Språng | 7ca375c | 2019-02-06 16:20:17 +0100 | [diff] [blame] | 75 | FieldTrialParameter<bool> bitrate_adjuster_; |
Erik Språng | 3d11e2f | 2019-04-15 14:48:30 +0200 | [diff] [blame] | 76 | FieldTrialParameter<bool> adjuster_use_headroom_; |
Erik Språng | 7f24fb9 | 2019-02-13 10:49:37 +0100 | [diff] [blame] | 77 | FieldTrialParameter<bool> vp8_s0_boost_; |
Erik Språng | 7a3fe89 | 2019-04-15 12:22:55 +0200 | [diff] [blame] | 78 | FieldTrialParameter<bool> vp8_dynamic_rate_; |
| 79 | FieldTrialParameter<bool> vp9_dynamic_rate_; |
Erik Språng | 7121564 | 2019-01-21 16:30:55 +0100 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | } // namespace webrtc |
| 83 | |
| 84 | #endif // RTC_BASE_EXPERIMENTS_RATE_CONTROL_SETTINGS_H_ |