2019-01-21 16:30:55 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef RTC_BASE_EXPERIMENTS_RATE_CONTROL_SETTINGS_H_
|
|
|
|
|
#define RTC_BASE_EXPERIMENTS_RATE_CONTROL_SETTINGS_H_
|
|
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
#include <optional>
|
|
|
|
|
|
2022-03-29 11:04:48 +02:00
|
|
|
#include "api/field_trials_view.h"
|
2019-12-06 13:13:40 +01:00
|
|
|
#include "api/units/data_size.h"
|
2019-02-04 11:09:46 +01:00
|
|
|
#include "api/video_codecs/video_codec.h"
|
2019-08-14 13:16:26 +02:00
|
|
|
#include "rtc_base/experiments/struct_parameters_parser.h"
|
2022-09-29 10:28:24 +02:00
|
|
|
#include "video/config/video_encoder_config.h"
|
2019-01-21 16:30:55 +01:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2019-08-14 13:16:26 +02:00
|
|
|
struct CongestionWindowConfig {
|
|
|
|
|
static constexpr char kKey[] = "WebRTC-CongestionWindow";
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<int> queue_size_ms;
|
|
|
|
|
std::optional<int> min_bitrate_bps;
|
|
|
|
|
std::optional<DataSize> initial_data_window;
|
2020-02-07 14:29:32 +01:00
|
|
|
bool drop_frame_only = false;
|
2019-08-14 13:16:26 +02:00
|
|
|
std::unique_ptr<StructParametersParser> Parser();
|
|
|
|
|
static CongestionWindowConfig Parse(absl::string_view config);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct VideoRateControlConfig {
|
|
|
|
|
static constexpr char kKey[] = "WebRTC-VideoRateControl";
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<double> pacing_factor;
|
2019-08-14 13:16:26 +02:00
|
|
|
bool alr_probing = false;
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<int> vp8_qp_max;
|
|
|
|
|
std::optional<int> vp8_min_pixels;
|
2020-10-22 17:44:42 +02:00
|
|
|
bool trust_vp8 = true;
|
|
|
|
|
bool trust_vp9 = true;
|
|
|
|
|
bool bitrate_adjuster = true;
|
|
|
|
|
bool adjuster_use_headroom = true;
|
|
|
|
|
bool vp8_s0_boost = false;
|
2019-10-30 13:01:46 +01:00
|
|
|
bool vp8_base_heavy_tl3_alloc = false;
|
2019-08-14 13:16:26 +02:00
|
|
|
|
|
|
|
|
std::unique_ptr<StructParametersParser> Parser();
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-21 16:30:55 +01:00
|
|
|
class RateControlSettings final {
|
|
|
|
|
public:
|
2024-05-06 12:03:53 +02:00
|
|
|
explicit RateControlSettings(const FieldTrialsView& key_value_config);
|
2019-01-21 16:30:55 +01:00
|
|
|
RateControlSettings(RateControlSettings&&);
|
2024-05-06 12:03:53 +02:00
|
|
|
~RateControlSettings();
|
2019-01-21 16:30:55 +01:00
|
|
|
|
|
|
|
|
// When CongestionWindowPushback is enabled, the pacer is oblivious to
|
|
|
|
|
// the congestion window. The relation between outstanding data and
|
|
|
|
|
// the congestion window affects encoder allocations directly.
|
|
|
|
|
bool UseCongestionWindow() const;
|
|
|
|
|
int64_t GetCongestionWindowAdditionalTimeMs() const;
|
|
|
|
|
bool UseCongestionWindowPushback() const;
|
2020-02-07 14:29:32 +01:00
|
|
|
bool UseCongestionWindowDropFrameOnly() const;
|
2019-01-21 16:30:55 +01:00
|
|
|
uint32_t CongestionWindowMinPushbackTargetBitrateBps() const;
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<DataSize> CongestionWindowInitialDataWindow() const;
|
2019-01-21 16:30:55 +01:00
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<double> GetPacingFactor() const;
|
2019-01-21 18:06:46 +01:00
|
|
|
bool UseAlrProbing() const;
|
|
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<int> LibvpxVp8QpMax() const;
|
|
|
|
|
std::optional<int> LibvpxVp8MinPixels() const;
|
2019-01-23 12:48:13 +01:00
|
|
|
bool LibvpxVp8TrustedRateController() const;
|
2019-02-13 10:49:37 +01:00
|
|
|
bool Vp8BoostBaseLayerQuality() const;
|
2019-04-15 12:22:55 +02:00
|
|
|
bool Vp8DynamicRateSettings() const;
|
2019-01-23 12:48:13 +01:00
|
|
|
bool LibvpxVp9TrustedRateController() const;
|
2019-04-15 12:22:55 +02:00
|
|
|
bool Vp9DynamicRateSettings() const;
|
2019-01-23 12:48:13 +01:00
|
|
|
|
2019-10-30 13:01:46 +01:00
|
|
|
bool Vp8BaseHeavyTl3RateAllocation() const;
|
|
|
|
|
|
2019-02-06 16:20:17 +01:00
|
|
|
bool UseEncoderBitrateAdjuster() const;
|
2019-04-15 14:48:30 +02:00
|
|
|
bool BitrateAdjusterCanUseNetworkHeadroom() const;
|
2019-01-29 18:28:06 +01:00
|
|
|
|
2019-01-21 16:30:55 +01:00
|
|
|
private:
|
2021-02-05 11:07:00 +01:00
|
|
|
CongestionWindowConfig congestion_window_config_;
|
2019-08-14 13:16:26 +02:00
|
|
|
VideoRateControlConfig video_config_;
|
2019-01-21 16:30:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // RTC_BASE_EXPERIMENTS_RATE_CONTROL_SETTINGS_H_
|