blob: 0dd4a14a6e6f845d07361ff73621c6bbc4eda468 [file] [log] [blame]
Erik Språng71215642019-01-21 15:30:551/*
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"
Jonas Orelande62c2f22022-03-29 09:04:4815#include "api/field_trials_view.h"
Christoffer Rodbro034f7672019-12-06 12:13:4016#include "api/units/data_size.h"
Rasmus Brandtc402dbe2019-02-04 10:09:4617#include "api/video_codecs/video_codec.h"
Sebastian Jansson0ee80082019-08-14 11:16:2618#include "rtc_base/experiments/struct_parameters_parser.h"
Jonas Oreland6c2dae22022-09-29 08:28:2419#include "video/config/video_encoder_config.h"
Erik Språng71215642019-01-21 15:30:5520
21namespace webrtc {
22
Sebastian Jansson0ee80082019-08-14 11:16:2623struct CongestionWindowConfig {
24 static constexpr char kKey[] = "WebRTC-CongestionWindow";
25 absl::optional<int> queue_size_ms;
26 absl::optional<int> min_bitrate_bps;
Christoffer Rodbro034f7672019-12-06 12:13:4027 absl::optional<DataSize> initial_data_window;
Ying Wang9b881ab2020-02-07 13:29:3228 bool drop_frame_only = false;
Sebastian Jansson0ee80082019-08-14 11:16:2629 std::unique_ptr<StructParametersParser> Parser();
30 static CongestionWindowConfig Parse(absl::string_view config);
31};
32
33struct VideoRateControlConfig {
34 static constexpr char kKey[] = "WebRTC-VideoRateControl";
35 absl::optional<double> pacing_factor;
36 bool alr_probing = false;
37 absl::optional<int> vp8_qp_max;
38 absl::optional<int> vp8_min_pixels;
Erik Språng9d69cbe2020-10-22 15:44:4239 bool trust_vp8 = true;
40 bool trust_vp9 = true;
Erik Språng9d69cbe2020-10-22 15:44:4241 bool bitrate_adjuster = true;
42 bool adjuster_use_headroom = true;
43 bool vp8_s0_boost = false;
Rasmus Brandt2b9317a2019-10-30 12:01:4644 bool vp8_base_heavy_tl3_alloc = false;
Sebastian Jansson0ee80082019-08-14 11:16:2645
46 std::unique_ptr<StructParametersParser> Parser();
47};
48
Erik Språng71215642019-01-21 15:30:5549class RateControlSettings final {
50 public:
Danil Chapovalovac426262024-05-06 10:03:5351 explicit RateControlSettings(const FieldTrialsView& key_value_config);
Erik Språng71215642019-01-21 15:30:5552 RateControlSettings(RateControlSettings&&);
Danil Chapovalovac426262024-05-06 10:03:5353 ~RateControlSettings();
Erik Språng71215642019-01-21 15:30:5554
Erik Språng71215642019-01-21 15:30:5555 // When CongestionWindowPushback is enabled, the pacer is oblivious to
56 // the congestion window. The relation between outstanding data and
57 // the congestion window affects encoder allocations directly.
58 bool UseCongestionWindow() const;
59 int64_t GetCongestionWindowAdditionalTimeMs() const;
60 bool UseCongestionWindowPushback() const;
Ying Wang9b881ab2020-02-07 13:29:3261 bool UseCongestionWindowDropFrameOnly() const;
Erik Språng71215642019-01-21 15:30:5562 uint32_t CongestionWindowMinPushbackTargetBitrateBps() const;
Christoffer Rodbro034f7672019-12-06 12:13:4063 absl::optional<DataSize> CongestionWindowInitialDataWindow() const;
Erik Språng71215642019-01-21 15:30:5564
Erik Språngcd76eab2019-01-21 17:06:4665 absl::optional<double> GetPacingFactor() const;
66 bool UseAlrProbing() const;
67
Åsa Perssond7dd49f2019-05-08 12:44:1268 absl::optional<int> LibvpxVp8QpMax() const;
Åsa Perssona0948492019-06-27 11:44:3069 absl::optional<int> LibvpxVp8MinPixels() const;
Erik Språng4b4266f2019-01-23 11:48:1370 bool LibvpxVp8TrustedRateController() const;
Erik Språng7f24fb92019-02-13 09:49:3771 bool Vp8BoostBaseLayerQuality() const;
Erik Språng7a3fe892019-04-15 10:22:5572 bool Vp8DynamicRateSettings() const;
Erik Språng4b4266f2019-01-23 11:48:1373 bool LibvpxVp9TrustedRateController() const;
Erik Språng7a3fe892019-04-15 10:22:5574 bool Vp9DynamicRateSettings() const;
Erik Språng4b4266f2019-01-23 11:48:1375
Rasmus Brandt2b9317a2019-10-30 12:01:4676 bool Vp8BaseHeavyTl3RateAllocation() const;
77
Erik Språng7ca375c2019-02-06 15:20:1778 bool UseEncoderBitrateAdjuster() const;
Erik Språng3d11e2f2019-04-15 12:48:3079 bool BitrateAdjusterCanUseNetworkHeadroom() const;
Erik Språng5118bbc2019-01-29 17:28:0680
Erik Språng71215642019-01-21 15:30:5581 private:
Ying Wang45930472021-02-05 10:07:0082 CongestionWindowConfig congestion_window_config_;
Sebastian Jansson0ee80082019-08-14 11:16:2683 VideoRateControlConfig video_config_;
Erik Språng71215642019-01-21 15:30:5584};
85
86} // namespace webrtc
87
88#endif // RTC_BASE_EXPERIMENTS_RATE_CONTROL_SETTINGS_H_