Propagate FieldTrialsView to query WebRTC-StableTargetRate field trial

Bug: webrtc:42220378
Change-Id: Ie2a2c3eccc36c98f09176eb6f4c5f06ded9f516f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362701
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43036}
This commit is contained in:
Danil Chapovalov 2024-09-17 14:58:25 +02:00 committed by WebRTC LUCI CQ
parent e81ba30897
commit 52ea2c3d2a
15 changed files with 203 additions and 93 deletions

View file

@ -38,7 +38,7 @@ class BuiltinVideoBitrateAllocatorFactory
if ((codec.codecType == kVideoCodecAV1 || if ((codec.codecType == kVideoCodecAV1 ||
codec.codecType == kVideoCodecVP9) && codec.codecType == kVideoCodecVP9) &&
codec.numberOfSimulcastStreams <= 1) { codec.numberOfSimulcastStreams <= 1) {
return std::make_unique<SvcRateAllocator>(codec); return std::make_unique<SvcRateAllocator>(codec, env.field_trials());
} }
return std::make_unique<SimulcastRateAllocator>(env, codec); return std::make_unique<SimulcastRateAllocator>(env, codec);
} }

View file

@ -408,6 +408,7 @@ rtc_library("video_coding_utility") {
"../../api:scoped_refptr", "../../api:scoped_refptr",
"../../api:sequence_checker", "../../api:sequence_checker",
"../../api/environment", "../../api/environment",
"../../api/units:data_rate",
"../../api/units:time_delta", "../../api/units:time_delta",
"../../api/video:encoded_frame", "../../api/video:encoded_frame",
"../../api/video:encoded_image", "../../api/video:encoded_image",
@ -654,17 +655,25 @@ rtc_library("webrtc_vp9") {
] ]
deps = [ deps = [
":codec_globals_headers",
":video_codec_interface", ":video_codec_interface",
":video_coding_utility", ":video_coding_utility",
":webrtc_libvpx_interface", ":webrtc_libvpx_interface",
":webrtc_vp9_helpers", "../../api:array_view",
"../../api:fec_controller_api", "../../api:fec_controller_api",
"../../api:field_trials_view", "../../api:field_trials_view",
"../../api:refcountedbase", "../../api:refcountedbase",
"../../api:scoped_refptr", "../../api:scoped_refptr",
"../../api/environment", "../../api/environment",
"../../api/transport/rtp:dependency_descriptor",
"../../api/video:encoded_image",
"../../api/video:render_resolution",
"../../api/video:video_bitrate_allocation",
"../../api/video:video_bitrate_allocator",
"../../api/video:video_codec_constants",
"../../api/video:video_frame", "../../api/video:video_frame",
"../../api/video:video_frame_i010", "../../api/video:video_frame_i010",
"../../api/video:video_frame_type",
"../../api/video:video_rtp_headers", "../../api/video:video_rtp_headers",
"../../api/video_codecs:scalability_mode", "../../api/video_codecs:scalability_mode",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",
@ -673,8 +682,8 @@ rtc_library("webrtc_vp9") {
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:event_tracer", "../../rtc_base:event_tracer",
"../../rtc_base:logging", "../../rtc_base:logging",
"../../rtc_base:safe_conversions",
"../../rtc_base:stringutils", "../../rtc_base:stringutils",
"../../rtc_base:timeutils",
"../../rtc_base/containers:flat_map", "../../rtc_base/containers:flat_map",
"../../rtc_base/experiments:encoder_info_settings", "../../rtc_base/experiments:encoder_info_settings",
"../../rtc_base/experiments:field_trial_parser", "../../rtc_base/experiments:field_trial_parser",
@ -689,7 +698,6 @@ rtc_library("webrtc_vp9") {
"//third_party/abseil-cpp/absl/algorithm:container", "//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/base:nullability", "//third_party/abseil-cpp/absl/base:nullability",
"//third_party/abseil-cpp/absl/container:inlined_vector", "//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/strings",
"//third_party/libyuv", "//third_party/libyuv",
] ]

View file

@ -14,39 +14,63 @@
#ifdef RTC_ENABLE_VP9 #ifdef RTC_ENABLE_VP9
#include <algorithm> #include <algorithm>
#include <limits> #include <cstddef>
#include <cstdint>
#include <cstring>
#include <iterator>
#include <optional> #include <optional>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/algorithm/container.h" #include "absl/algorithm/container.h"
#include "absl/memory/memory.h" #include "absl/container/inlined_vector.h"
#include "absl/strings/match.h" #include "api/array_view.h"
#include "api/video/color_space.h" #include "api/environment/environment.h"
#include "api/fec_controller_override.h"
#include "api/field_trials_view.h"
#include "api/scoped_refptr.h"
#include "api/transport/rtp/dependency_descriptor.h"
#include "api/video/encoded_image.h"
#include "api/video/i010_buffer.h" #include "api/video/i010_buffer.h"
#include "api/video/render_resolution.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video/video_bitrate_allocator.h"
#include "api/video/video_codec_constants.h"
#include "api/video/video_codec_type.h"
#include "api/video/video_frame.h"
#include "api/video/video_frame_buffer.h"
#include "api/video/video_frame_type.h"
#include "api/video_codecs/scalability_mode.h" #include "api/video_codecs/scalability_mode.h"
#include "common_video/include/video_frame_buffer.h" #include "api/video_codecs/video_codec.h"
#include "common_video/libyuv/include/webrtc_libyuv.h" #include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/vp9_profile.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/video_coding/codecs/interface/common_constants.h"
#include "modules/video_coding/codecs/interface/libvpx_interface.h"
#include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
#include "modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h" #include "modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "modules/video_coding/svc/create_scalability_structure.h" #include "modules/video_coding/svc/create_scalability_structure.h"
#include "modules/video_coding/svc/scalability_mode_util.h" #include "modules/video_coding/svc/scalability_mode_util.h"
#include "modules/video_coding/svc/scalable_video_controller.h" #include "modules/video_coding/svc/scalable_video_controller.h"
#include "modules/video_coding/svc/scalable_video_controller_no_layering.h" #include "modules/video_coding/svc/scalable_video_controller_no_layering.h"
#include "modules/video_coding/svc/svc_rate_allocator.h" #include "modules/video_coding/svc/svc_rate_allocator.h"
#include "modules/video_coding/utility/framerate_controller_deprecated.h"
#include "modules/video_coding/utility/simulcast_utility.h" #include "modules/video_coding/utility/simulcast_utility.h"
#include "modules/video_coding/utility/vp9_uncompressed_header_parser.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/containers/flat_map.h"
#include "rtc_base/experiments/field_trial_list.h" #include "rtc_base/experiments/field_trial_list.h"
#include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/experiments/rate_control_settings.h" #include "rtc_base/experiments/rate_control_settings.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/strings/string_builder.h" #include "rtc_base/strings/string_builder.h"
#include "rtc_base/time_utils.h"
#include "rtc_base/trace_event.h" #include "rtc_base/trace_event.h"
#include "third_party/libyuv/include/libyuv/convert.h"
#include "vpx/vp8cx.h" #include "vpx/vp8cx.h"
#include "vpx/vpx_encoder.h" #include "vpx/vpx_encoder.h"
#include "vpx/vpx_image.h"
#if (defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64)) && \ #if (defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64)) && \
(defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)) (defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
@ -229,7 +253,8 @@ void LibvpxVp9Encoder::EncoderOutputCodedPacketCallback(vpx_codec_cx_pkt* pkt,
LibvpxVp9Encoder::LibvpxVp9Encoder(const Environment& env, LibvpxVp9Encoder::LibvpxVp9Encoder(const Environment& env,
Vp9EncoderSettings settings, Vp9EncoderSettings settings,
std::unique_ptr<LibvpxInterface> interface) std::unique_ptr<LibvpxInterface> interface)
: libvpx_(std::move(interface)), : env_(env),
libvpx_(std::move(interface)),
encoded_image_(), encoded_image_(),
encoded_complete_callback_(nullptr), encoded_complete_callback_(nullptr),
profile_(settings.profile), profile_(settings.profile),
@ -793,7 +818,7 @@ int LibvpxVp9Encoder::InitAndSetControlSettings() {
RTC_DCHECK_EQ(performance_flags_by_spatial_index_.size(), RTC_DCHECK_EQ(performance_flags_by_spatial_index_.size(),
static_cast<size_t>(num_spatial_layers_)); static_cast<size_t>(num_spatial_layers_));
SvcRateAllocator init_allocator(codec_); SvcRateAllocator init_allocator(codec_, env_.field_trials());
current_bitrate_allocation_ = current_bitrate_allocation_ =
init_allocator.Allocate(VideoBitrateAllocationParameters( init_allocator.Allocate(VideoBitrateAllocationParameters(
codec_.startBitrate * 1000, codec_.maxFramerate)); codec_.startBitrate * 1000, codec_.maxFramerate));

View file

@ -15,6 +15,8 @@
#ifdef RTC_ENABLE_VP9 #ifdef RTC_ENABLE_VP9
#include <array> #include <array>
#include <cstddef>
#include <cstdint>
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <vector> #include <vector>
@ -22,20 +24,29 @@
#include "api/environment/environment.h" #include "api/environment/environment.h"
#include "api/fec_controller_override.h" #include "api/fec_controller_override.h"
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "api/scoped_refptr.h"
#include "api/video/encoded_image.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video/video_frame.h"
#include "api/video/video_frame_buffer.h"
#include "api/video/video_frame_type.h"
#include "api/video_codecs/scalability_mode.h" #include "api/video_codecs/scalability_mode.h"
#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/video_encoder.h" #include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/vp9_profile.h" #include "api/video_codecs/vp9_profile.h"
#include "common_video/include/video_frame_buffer_pool.h"
#include "modules/video_coding/codecs/interface/libvpx_interface.h" #include "modules/video_coding/codecs/interface/libvpx_interface.h"
#include "modules/video_coding/codecs/vp9/include/vp9.h" #include "modules/video_coding/codecs/vp9/include/vp9.h"
#include "modules/video_coding/codecs/vp9/svc_config.h" #include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
#include "modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h" #include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/svc/scalable_video_controller.h" #include "modules/video_coding/svc/scalable_video_controller.h"
#include "modules/video_coding/svc/simulcast_to_svc_converter.h" #include "modules/video_coding/svc/simulcast_to_svc_converter.h"
#include "modules/video_coding/utility/framerate_controller_deprecated.h" #include "modules/video_coding/utility/framerate_controller_deprecated.h"
#include "rtc_base/containers/flat_map.h" #include "rtc_base/containers/flat_map.h"
#include "rtc_base/experiments/encoder_info_settings.h" #include "rtc_base/experiments/encoder_info_settings.h"
#include "vpx/vp8cx.h" #include "vpx/vp8cx.h"
#include "vpx/vpx_codec.h"
#include "vpx/vpx_encoder.h"
#include "vpx/vpx_image.h"
namespace webrtc { namespace webrtc {
@ -120,6 +131,7 @@ class LibvpxVp9Encoder : public VideoEncoder {
rtc::scoped_refptr<VideoFrameBuffer> PrepareBufferForProfile0( rtc::scoped_refptr<VideoFrameBuffer> PrepareBufferForProfile0(
rtc::scoped_refptr<VideoFrameBuffer> buffer); rtc::scoped_refptr<VideoFrameBuffer> buffer);
const Environment env_;
const std::unique_ptr<LibvpxInterface> libvpx_; const std::unique_ptr<LibvpxInterface> libvpx_;
EncodedImage encoded_image_; EncodedImage encoded_image_;
CodecSpecificInfo codec_specific_; CodecSpecificInfo codec_specific_;

View file

@ -70,9 +70,15 @@ rtc_source_set("svc_rate_allocator") {
] ]
deps = [ deps = [
":scalability_structures", ":scalability_structures",
":scalable_video_controller",
"../../../api:field_trials_view",
"../../../api/transport:field_trial_based_config",
"../../../api/units:data_rate",
"../../../api/video:video_bitrate_allocation", "../../../api/video:video_bitrate_allocation",
"../../../api/video:video_bitrate_allocator", "../../../api/video:video_bitrate_allocator",
"../../../api/video:video_codec_constants", "../../../api/video:video_codec_constants",
"../../../api/video:video_frame",
"../../../api/video_codecs:scalability_mode",
"../../../api/video_codecs:video_codecs_api", "../../../api/video_codecs:video_codecs_api",
"../../../rtc_base:checks", "../../../rtc_base:checks",
"../../../rtc_base/experiments:stable_target_rate_experiment", "../../../rtc_base/experiments:stable_target_rate_experiment",
@ -134,11 +140,18 @@ if (rtc_include_tests) {
deps = [ deps = [
":svc_rate_allocator", ":svc_rate_allocator",
"..:webrtc_vp9_helpers", "..:webrtc_vp9_helpers",
"../../../api/units:data_rate",
"../../../api/video:video_bitrate_allocation",
"../../../api/video:video_bitrate_allocator",
"../../../api/video:video_codec_constants",
"../../../api/video:video_frame", "../../../api/video:video_frame",
"../../../modules/video_coding/codecs/av1:av1_svc_config", "../../../api/video_codecs:scalability_mode",
"../../../api/video_codecs:video_codecs_api",
"../../../rtc_base:checks", "../../../rtc_base:checks",
"../../../test:field_trial", "../../../test:explicit_key_value_config",
"../../../test:test_support", "../../../test:test_support",
"../codecs/av1:av1_svc_config",
"//third_party/abseil-cpp/absl/container:inlined_vector",
] ]
} }

View file

@ -14,10 +14,21 @@
#include <cmath> #include <cmath>
#include <cstddef> #include <cstddef>
#include <numeric> #include <numeric>
#include <optional>
#include <vector> #include <vector>
#include "absl/container/inlined_vector.h" #include "absl/container/inlined_vector.h"
#include "api/field_trials_view.h"
#include "api/transport/field_trial_based_config.h"
#include "api/units/data_rate.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video/video_bitrate_allocator.h"
#include "api/video/video_codec_constants.h"
#include "api/video/video_codec_type.h"
#include "api/video_codecs/scalability_mode.h"
#include "api/video_codecs/video_codec.h"
#include "modules/video_coding/svc/create_scalability_structure.h" #include "modules/video_coding/svc/create_scalability_structure.h"
#include "modules/video_coding/svc/scalable_video_controller.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
namespace webrtc { namespace webrtc {
@ -236,9 +247,13 @@ SvcRateAllocator::NumLayers SvcRateAllocator::GetNumLayers(
} }
SvcRateAllocator::SvcRateAllocator(const VideoCodec& codec) SvcRateAllocator::SvcRateAllocator(const VideoCodec& codec)
: SvcRateAllocator(codec, FieldTrialBasedConfig()) {}
SvcRateAllocator::SvcRateAllocator(const VideoCodec& codec,
const FieldTrialsView& field_trials)
: codec_(codec), : codec_(codec),
num_layers_(GetNumLayers(codec)), num_layers_(GetNumLayers(codec)),
experiment_settings_(StableTargetRateExperiment::ParseFromFieldTrials()), experiment_settings_(field_trials),
cumulative_layer_start_bitrates_(GetLayerStartBitrates(codec)), cumulative_layer_start_bitrates_(GetLayerStartBitrates(codec)),
last_active_layer_count_(0) { last_active_layer_count_(0) {
RTC_DCHECK_GT(num_layers_.spatial, 0); RTC_DCHECK_GT(num_layers_.spatial, 0);

View file

@ -12,11 +12,12 @@
#define MODULES_VIDEO_CODING_SVC_SVC_RATE_ALLOCATOR_H_ #define MODULES_VIDEO_CODING_SVC_SVC_RATE_ALLOCATOR_H_
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <vector> #include <vector>
#include "absl/container/inlined_vector.h" #include "absl/container/inlined_vector.h"
#include "api/field_trials_view.h"
#include "api/units/data_rate.h"
#include "api/video/video_bitrate_allocation.h" #include "api/video/video_bitrate_allocation.h"
#include "api/video/video_bitrate_allocator.h" #include "api/video/video_bitrate_allocator.h"
#include "api/video/video_codec_constants.h" #include "api/video/video_codec_constants.h"
@ -27,7 +28,9 @@ namespace webrtc {
class SvcRateAllocator : public VideoBitrateAllocator { class SvcRateAllocator : public VideoBitrateAllocator {
public: public:
explicit SvcRateAllocator(const VideoCodec& codec); [[deprecated]] explicit SvcRateAllocator(const VideoCodec& codec);
SvcRateAllocator(const VideoCodec& codec,
const FieldTrialsView& field_trials);
VideoBitrateAllocation Allocate( VideoBitrateAllocation Allocate(
VideoBitrateAllocationParameters parameters) override; VideoBitrateAllocationParameters parameters) override;

View file

@ -11,13 +11,23 @@
#include "modules/video_coding/svc/svc_rate_allocator.h" #include "modules/video_coding/svc/svc_rate_allocator.h"
#include <algorithm> #include <algorithm>
#include <cstddef>
#include <cstdint>
#include <vector> #include <vector>
#include "absl/container/inlined_vector.h"
#include "api/units/data_rate.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video/video_bitrate_allocator.h"
#include "api/video/video_codec_constants.h"
#include "api/video/video_codec_type.h" #include "api/video/video_codec_type.h"
#include "api/video_codecs/scalability_mode.h"
#include "api/video_codecs/spatial_layer.h"
#include "api/video_codecs/video_codec.h"
#include "modules/video_coding/codecs/av1/av1_svc_config.h" #include "modules/video_coding/codecs/av1/av1_svc_config.h"
#include "modules/video_coding/codecs/vp9/svc_config.h" #include "modules/video_coding/codecs/vp9/svc_config.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "test/field_trial.h" #include "test/explicit_key_value_config.h"
#include "test/gtest.h" #include "test/gtest.h"
namespace webrtc { namespace webrtc {
@ -76,7 +86,8 @@ static VideoCodec Configure(VideoCodecType codecType,
TEST(SvcRateAllocatorTest, SingleLayerFor320x180Input) { TEST(SvcRateAllocatorTest, SingleLayerFor320x180Input) {
VideoCodec codec = Configure(kVideoCodecVP9, 320, 180, 3, 3, false); VideoCodec codec = Configure(kVideoCodecVP9, 320, 180, 3, 3, false);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
allocator.Allocate(VideoBitrateAllocationParameters(1000 * 1000, 30)); allocator.Allocate(VideoBitrateAllocationParameters(1000 * 1000, 30));
@ -87,7 +98,8 @@ TEST(SvcRateAllocatorTest, SingleLayerFor320x180Input) {
TEST(SvcRateAllocatorTest, TwoLayersFor640x360Input) { TEST(SvcRateAllocatorTest, TwoLayersFor640x360Input) {
VideoCodec codec = Configure(kVideoCodecVP9, 640, 360, 3, 3, false); VideoCodec codec = Configure(kVideoCodecVP9, 640, 360, 3, 3, false);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
allocator.Allocate(VideoBitrateAllocationParameters(1000 * 1000, 30)); allocator.Allocate(VideoBitrateAllocationParameters(1000 * 1000, 30));
@ -99,7 +111,8 @@ TEST(SvcRateAllocatorTest, TwoLayersFor640x360Input) {
TEST(SvcRateAllocatorTest, ThreeLayersFor1280x720Input) { TEST(SvcRateAllocatorTest, ThreeLayersFor1280x720Input) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
allocator.Allocate(VideoBitrateAllocationParameters(1000 * 1000, 30)); allocator.Allocate(VideoBitrateAllocationParameters(1000 * 1000, 30));
@ -112,7 +125,8 @@ TEST(SvcRateAllocatorTest, ThreeLayersFor1280x720Input) {
TEST(SvcRateAllocatorTest, TEST(SvcRateAllocatorTest,
BaseLayerNonZeroBitrateEvenIfTotalIfLessThanMinimum) { BaseLayerNonZeroBitrateEvenIfTotalIfLessThanMinimum) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
const SpatialLayer* layers = codec.spatialLayers; const SpatialLayer* layers = codec.spatialLayers;
@ -126,7 +140,8 @@ TEST(SvcRateAllocatorTest,
TEST(SvcRateAllocatorTest, Disable640x360Layer) { TEST(SvcRateAllocatorTest, Disable640x360Layer) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
const SpatialLayer* layers = codec.spatialLayers; const SpatialLayer* layers = codec.spatialLayers;
@ -143,7 +158,8 @@ TEST(SvcRateAllocatorTest, Disable640x360Layer) {
TEST(SvcRateAllocatorTest, Disable1280x720Layer) { TEST(SvcRateAllocatorTest, Disable1280x720Layer) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
const SpatialLayer* layers = codec.spatialLayers; const SpatialLayer* layers = codec.spatialLayers;
@ -161,7 +177,8 @@ TEST(SvcRateAllocatorTest, Disable1280x720Layer) {
TEST(SvcRateAllocatorTest, BitrateIsCapped) { TEST(SvcRateAllocatorTest, BitrateIsCapped) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
const SpatialLayer* layers = codec.spatialLayers; const SpatialLayer* layers = codec.spatialLayers;
@ -178,7 +195,8 @@ TEST(SvcRateAllocatorTest, BitrateIsCapped) {
TEST(SvcRateAllocatorTest, MinBitrateToGetQualityLayer) { TEST(SvcRateAllocatorTest, MinBitrateToGetQualityLayer) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 1, true); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 1, true);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
const SpatialLayer* layers = codec.spatialLayers; const SpatialLayer* layers = codec.spatialLayers;
@ -196,6 +214,7 @@ TEST(SvcRateAllocatorTest, MinBitrateToGetQualityLayer) {
} }
TEST(SvcRateAllocatorTest, DeactivateHigherLayers) { TEST(SvcRateAllocatorTest, DeactivateHigherLayers) {
ExplicitKeyValueConfig field_trials("");
for (int deactivated_idx = 2; deactivated_idx >= 0; --deactivated_idx) { for (int deactivated_idx = 2; deactivated_idx >= 0; --deactivated_idx) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 1, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 1, false);
EXPECT_LE(codec.VP9()->numberOfSpatialLayers, 3U); EXPECT_LE(codec.VP9()->numberOfSpatialLayers, 3U);
@ -203,7 +222,7 @@ TEST(SvcRateAllocatorTest, DeactivateHigherLayers) {
for (int i = deactivated_idx; i < 3; ++i) for (int i = deactivated_idx; i < 3; ++i)
codec.spatialLayers[i].active = false; codec.spatialLayers[i].active = false;
SvcRateAllocator allocator = SvcRateAllocator(codec); SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
VideoBitrateAllocation allocation = allocator.Allocate( VideoBitrateAllocation allocation = allocator.Allocate(
VideoBitrateAllocationParameters(10 * 1000 * 1000, 30)); VideoBitrateAllocationParameters(10 * 1000 * 1000, 30));
@ -221,6 +240,7 @@ TEST(SvcRateAllocatorTest, DeactivateHigherLayers) {
} }
TEST(SvcRateAllocatorTest, DeactivateLowerLayers) { TEST(SvcRateAllocatorTest, DeactivateLowerLayers) {
ExplicitKeyValueConfig field_trials("");
for (int deactivated_idx = 0; deactivated_idx < 3; ++deactivated_idx) { for (int deactivated_idx = 0; deactivated_idx < 3; ++deactivated_idx) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 1, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 1, false);
EXPECT_LE(codec.VP9()->numberOfSpatialLayers, 3U); EXPECT_LE(codec.VP9()->numberOfSpatialLayers, 3U);
@ -228,7 +248,7 @@ TEST(SvcRateAllocatorTest, DeactivateLowerLayers) {
for (int i = deactivated_idx; i >= 0; --i) for (int i = deactivated_idx; i >= 0; --i)
codec.spatialLayers[i].active = false; codec.spatialLayers[i].active = false;
SvcRateAllocator allocator = SvcRateAllocator(codec); SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
VideoBitrateAllocation allocation = allocator.Allocate( VideoBitrateAllocation allocation = allocator.Allocate(
VideoBitrateAllocationParameters(10 * 1000 * 1000, 30)); VideoBitrateAllocationParameters(10 * 1000 * 1000, 30));
@ -248,7 +268,8 @@ TEST(SvcRateAllocatorTest, DeactivateLowerLayers) {
TEST(SvcRateAllocatorTest, SignalsBwLimited) { TEST(SvcRateAllocatorTest, SignalsBwLimited) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 1, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 1, false);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
// Rough estimate calculated by hand. // Rough estimate calculated by hand.
uint32_t min_to_enable_all = 900000; uint32_t min_to_enable_all = 900000;
@ -310,8 +331,9 @@ TEST(SvcRateAllocatorTest, SupportsAv1) {
codec.spatialLayers[2].minBitrate = 193; codec.spatialLayers[2].minBitrate = 193;
codec.spatialLayers[2].targetBitrate = 305; codec.spatialLayers[2].targetBitrate = 305;
codec.spatialLayers[2].maxBitrate = 418; codec.spatialLayers[2].maxBitrate = 418;
ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator(codec); SvcRateAllocator allocator(codec, field_trials);
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
allocator.Allocate(VideoBitrateAllocationParameters(1'000'000, 30)); allocator.Allocate(VideoBitrateAllocationParameters(1'000'000, 30));
@ -339,8 +361,9 @@ TEST(SvcRateAllocatorTest, SupportsAv1WithSkippedLayer) {
codec.spatialLayers[2].minBitrate = 193; codec.spatialLayers[2].minBitrate = 193;
codec.spatialLayers[2].targetBitrate = 305; codec.spatialLayers[2].targetBitrate = 305;
codec.spatialLayers[2].maxBitrate = 418; codec.spatialLayers[2].maxBitrate = 418;
ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator(codec); SvcRateAllocator allocator(codec, field_trials);
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
allocator.Allocate(VideoBitrateAllocationParameters(1'000'000, 30)); allocator.Allocate(VideoBitrateAllocationParameters(1'000'000, 30));
@ -368,8 +391,9 @@ TEST(SvcRateAllocatorTest, UsesScalabilityModeToGetNumberOfLayers) {
codec.spatialLayers[2].minBitrate = 193; codec.spatialLayers[2].minBitrate = 193;
codec.spatialLayers[2].targetBitrate = 305; codec.spatialLayers[2].targetBitrate = 305;
codec.spatialLayers[2].maxBitrate = 418; codec.spatialLayers[2].maxBitrate = 418;
ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator(codec); SvcRateAllocator allocator(codec, field_trials);
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
allocator.Allocate(VideoBitrateAllocationParameters(1'000'000, 30)); allocator.Allocate(VideoBitrateAllocationParameters(1'000'000, 30));
@ -386,7 +410,9 @@ TEST(SvcRateAllocatorTest, UsesScalabilityModeToGetNumberOfLayers) {
TEST(SvcRateAllocatorTest, CapsAllocationToMaxBitrate) { TEST(SvcRateAllocatorTest, CapsAllocationToMaxBitrate) {
VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false); VideoCodec codec = Configure(kVideoCodecVP9, 1280, 720, 3, 3, false);
codec.maxBitrate = 70; // Cap the overall max bitrate to 70kbps. codec.maxBitrate = 70; // Cap the overall max bitrate to 70kbps.
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
// Allocate 3Mbps which should be enough for all layers. // Allocate 3Mbps which should be enough for all layers.
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
@ -423,7 +449,8 @@ TEST_P(SvcRateAllocatorTestParametrizedContentType, MaxBitrate) {
TEST_P(SvcRateAllocatorTestParametrizedContentType, PaddingBitrate) { TEST_P(SvcRateAllocatorTestParametrizedContentType, PaddingBitrate) {
VideoCodec codec = VideoCodec codec =
Configure(kVideoCodecVP9, 1280, 720, 3, 1, is_screen_sharing_); Configure(kVideoCodecVP9, 1280, 720, 3, 1, is_screen_sharing_);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
DataRate padding_bitrate = SvcRateAllocator::GetPaddingBitrate(codec); DataRate padding_bitrate = SvcRateAllocator::GetPaddingBitrate(codec);
@ -467,7 +494,7 @@ TEST_P(SvcRateAllocatorTestParametrizedContentType, PaddingBitrate) {
} }
TEST_P(SvcRateAllocatorTestParametrizedContentType, StableBitrate) { TEST_P(SvcRateAllocatorTestParametrizedContentType, StableBitrate) {
ScopedFieldTrials field_trial( ExplicitKeyValueConfig field_trials(
"WebRTC-StableTargetRate/enabled:true,video_hysteresis_factor:1.0," "WebRTC-StableTargetRate/enabled:true,video_hysteresis_factor:1.0,"
"screenshare_hysteresis_factor:1.0/"); "screenshare_hysteresis_factor:1.0/");
@ -486,7 +513,7 @@ TEST_P(SvcRateAllocatorTestParametrizedContentType, StableBitrate) {
: DataRate::KilobitsPerSec(codec.spatialLayers[0].maxBitrate + : DataRate::KilobitsPerSec(codec.spatialLayers[0].maxBitrate +
codec.spatialLayers[1].maxBitrate); codec.spatialLayers[1].maxBitrate);
SvcRateAllocator allocator = SvcRateAllocator(codec); SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
// Two layers, stable and target equal. // Two layers, stable and target equal.
auto allocation = allocator.Allocate(VideoBitrateAllocationParameters( auto allocation = allocator.Allocate(VideoBitrateAllocationParameters(
@ -532,10 +559,10 @@ TEST_P(SvcRateAllocatorTestParametrizedContentType,
const DataRate min_rate_two_layers = start_rates[1]; const DataRate min_rate_two_layers = start_rates[1];
const DataRate min_rate_three_layers = start_rates[2]; const DataRate min_rate_three_layers = start_rates[2];
ScopedFieldTrials field_trial( ExplicitKeyValueConfig field_trials(
"WebRTC-StableTargetRate/enabled:true,video_hysteresis_factor:1.1," "WebRTC-StableTargetRate/enabled:true,video_hysteresis_factor:1.1,"
"screenshare_hysteresis_factor:1.1/"); "screenshare_hysteresis_factor:1.1/");
SvcRateAllocator allocator = SvcRateAllocator(codec); SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
// Always use max bitrate as target, verify only stable is used for layer // Always use max bitrate as target, verify only stable is used for layer
// count selection. // count selection.
const DataRate max_bitrate = allocator.GetMaxBitrate(codec); const DataRate max_bitrate = allocator.GetMaxBitrate(codec);
@ -618,7 +645,8 @@ TEST_P(SvcRateAllocatorTestParametrizedContentType,
TEST_P(SvcRateAllocatorTestParametrizedContentType, TwoTemporalLayersAv1) { TEST_P(SvcRateAllocatorTestParametrizedContentType, TwoTemporalLayersAv1) {
VideoCodec codec = VideoCodec codec =
Configure(kVideoCodecAV1, 1280, 720, 1, 2, is_screen_sharing_); Configure(kVideoCodecAV1, 1280, 720, 1, 2, is_screen_sharing_);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
allocator.Allocate(VideoBitrateAllocationParameters( allocator.Allocate(VideoBitrateAllocationParameters(
/*total_bitrate_bps=*/1024'000, /*framerate=*/30)); /*total_bitrate_bps=*/1024'000, /*framerate=*/30));
@ -632,7 +660,8 @@ TEST_P(SvcRateAllocatorTestParametrizedContentType, TwoTemporalLayersAv1) {
TEST_P(SvcRateAllocatorTestParametrizedContentType, ThreeTemporalLayersAv1) { TEST_P(SvcRateAllocatorTestParametrizedContentType, ThreeTemporalLayersAv1) {
VideoCodec codec = VideoCodec codec =
Configure(kVideoCodecAV1, 1280, 720, 1, 3, is_screen_sharing_); Configure(kVideoCodecAV1, 1280, 720, 1, 3, is_screen_sharing_);
SvcRateAllocator allocator = SvcRateAllocator(codec); ExplicitKeyValueConfig field_trials("");
SvcRateAllocator allocator = SvcRateAllocator(codec, field_trials);
VideoBitrateAllocation allocation = VideoBitrateAllocation allocation =
allocator.Allocate(VideoBitrateAllocationParameters( allocator.Allocate(VideoBitrateAllocationParameters(
/*total_bitrate_bps=*/1024'000, /*framerate=*/30)); /*total_bitrate_bps=*/1024'000, /*framerate=*/30));

View file

@ -13,14 +13,19 @@
#include <stdio.h> #include <stdio.h>
#include <algorithm> #include <algorithm>
#include <cmath>
#include <cstdint> #include <cstdint>
#include <numeric> #include <numeric>
#include <string>
#include <tuple> #include <tuple>
#include <vector> #include <vector>
#include "api/environment/environment.h" #include "api/environment/environment.h"
#include "api/units/data_rate.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video/video_bitrate_allocator.h"
#include "api/video/video_codec_constants.h"
#include "api/video/video_codec_type.h"
#include "api/video_codecs/simulcast_stream.h"
#include "api/video_codecs/video_codec.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/experiments/rate_control_settings.h" #include "rtc_base/experiments/rate_control_settings.h"
@ -61,8 +66,7 @@ float SimulcastRateAllocator::GetTemporalRateAllocation(
SimulcastRateAllocator::SimulcastRateAllocator(const Environment& env, SimulcastRateAllocator::SimulcastRateAllocator(const Environment& env,
const VideoCodec& codec) const VideoCodec& codec)
: codec_(codec), : codec_(codec),
stable_rate_settings_(StableTargetRateExperiment::ParseFromKeyValueConfig( stable_rate_settings_(env.field_trials()),
&env.field_trials())),
rate_control_settings_(env.field_trials()), rate_control_settings_(env.field_trials()),
legacy_conference_mode_(false) {} legacy_conference_mode_(false) {}

View file

@ -145,7 +145,6 @@ rtc_library("stable_target_rate_experiment") {
deps = [ deps = [
":field_trial_parser", ":field_trial_parser",
"../../api:field_trials_view", "../../api:field_trials_view",
"../../api/transport:field_trial_based_config",
] ]
} }

View file

@ -10,7 +10,8 @@
#include "rtc_base/experiments/stable_target_rate_experiment.h" #include "rtc_base/experiments/stable_target_rate_experiment.h"
#include "api/transport/field_trial_based_config.h" #include "api/field_trials_view.h"
#include "rtc_base/experiments/field_trial_parser.h"
namespace webrtc { namespace webrtc {
namespace { namespace {
@ -18,17 +19,15 @@ constexpr char kFieldTrialName[] = "WebRTC-StableTargetRate";
} // namespace } // namespace
StableTargetRateExperiment::StableTargetRateExperiment( StableTargetRateExperiment::StableTargetRateExperiment(
const FieldTrialsView* const key_value_config, const FieldTrialsView& key_value_config)
double default_video_hysteresis,
double default_screenshare_hysteresis)
: enabled_("enabled", false), : enabled_("enabled", false),
video_hysteresis_factor_("video_hysteresis_factor", video_hysteresis_factor_("video_hysteresis_factor",
default_video_hysteresis), /*default_value=*/1.2),
screenshare_hysteresis_factor_("screenshare_hysteresis_factor", screenshare_hysteresis_factor_("screenshare_hysteresis_factor",
default_screenshare_hysteresis) { /*default_value=*/1.35) {
ParseFieldTrial( ParseFieldTrial(
{&enabled_, &video_hysteresis_factor_, &screenshare_hysteresis_factor_}, {&enabled_, &video_hysteresis_factor_, &screenshare_hysteresis_factor_},
key_value_config->Lookup(kFieldTrialName)); key_value_config.Lookup(kFieldTrialName));
} }
StableTargetRateExperiment::StableTargetRateExperiment( StableTargetRateExperiment::StableTargetRateExperiment(
@ -36,18 +35,6 @@ StableTargetRateExperiment::StableTargetRateExperiment(
StableTargetRateExperiment::StableTargetRateExperiment( StableTargetRateExperiment::StableTargetRateExperiment(
StableTargetRateExperiment&&) = default; StableTargetRateExperiment&&) = default;
StableTargetRateExperiment StableTargetRateExperiment::ParseFromFieldTrials() {
FieldTrialBasedConfig config;
return ParseFromKeyValueConfig(&config);
}
StableTargetRateExperiment StableTargetRateExperiment::ParseFromKeyValueConfig(
const FieldTrialsView* const key_value_config) {
return StableTargetRateExperiment(key_value_config,
/*default_video_hysteresis=*/1.2,
/*default_screenshare_hysteresis=*/1.35);
}
bool StableTargetRateExperiment::IsEnabled() const { bool StableTargetRateExperiment::IsEnabled() const {
return enabled_.Get(); return enabled_.Get();
} }

View file

@ -18,22 +18,15 @@ namespace webrtc {
class StableTargetRateExperiment { class StableTargetRateExperiment {
public: public:
explicit StableTargetRateExperiment(const FieldTrialsView& field_trials);
StableTargetRateExperiment(const StableTargetRateExperiment&); StableTargetRateExperiment(const StableTargetRateExperiment&);
StableTargetRateExperiment(StableTargetRateExperiment&&); StableTargetRateExperiment(StableTargetRateExperiment&&);
static StableTargetRateExperiment ParseFromFieldTrials();
static StableTargetRateExperiment ParseFromKeyValueConfig(
const FieldTrialsView* const key_value_config);
bool IsEnabled() const; bool IsEnabled() const;
double GetVideoHysteresisFactor() const; double GetVideoHysteresisFactor() const;
double GetScreenshareHysteresisFactor() const; double GetScreenshareHysteresisFactor() const;
private: private:
explicit StableTargetRateExperiment(
const FieldTrialsView* const key_value_config,
double default_video_hysteresis,
double default_screenshare_hysteresis);
FieldTrialParameter<bool> enabled_; FieldTrialParameter<bool> enabled_;
FieldTrialParameter<double> video_hysteresis_factor_; FieldTrialParameter<double> video_hysteresis_factor_;
FieldTrialParameter<double> screenshare_hysteresis_factor_; FieldTrialParameter<double> screenshare_hysteresis_factor_;

View file

@ -10,46 +10,45 @@
#include "rtc_base/experiments/stable_target_rate_experiment.h" #include "rtc_base/experiments/stable_target_rate_experiment.h"
#include "test/field_trial.h" #include "test/explicit_key_value_config.h"
#include "test/gtest.h" #include "test/gtest.h"
namespace webrtc { namespace webrtc {
using test::ExplicitKeyValueConfig;
TEST(StableBweExperimentTest, Default) { TEST(StableBweExperimentTest, Default) {
StableTargetRateExperiment config = ExplicitKeyValueConfig field_trials("");
StableTargetRateExperiment::ParseFromFieldTrials(); StableTargetRateExperiment config(field_trials);
EXPECT_FALSE(config.IsEnabled()); EXPECT_FALSE(config.IsEnabled());
EXPECT_EQ(config.GetVideoHysteresisFactor(), 1.2); EXPECT_EQ(config.GetVideoHysteresisFactor(), 1.2);
EXPECT_EQ(config.GetScreenshareHysteresisFactor(), 1.35); EXPECT_EQ(config.GetScreenshareHysteresisFactor(), 1.35);
} }
TEST(StableBweExperimentTest, EnabledNoHysteresis) { TEST(StableBweExperimentTest, EnabledNoHysteresis) {
webrtc::test::ScopedFieldTrials field_trials( ExplicitKeyValueConfig field_trials("WebRTC-StableTargetRate/enabled:true/");
"WebRTC-StableTargetRate/enabled:true/");
StableTargetRateExperiment config = StableTargetRateExperiment config(field_trials);
StableTargetRateExperiment::ParseFromFieldTrials();
EXPECT_TRUE(config.IsEnabled()); EXPECT_TRUE(config.IsEnabled());
EXPECT_EQ(config.GetVideoHysteresisFactor(), 1.2); EXPECT_EQ(config.GetVideoHysteresisFactor(), 1.2);
EXPECT_EQ(config.GetScreenshareHysteresisFactor(), 1.35); EXPECT_EQ(config.GetScreenshareHysteresisFactor(), 1.35);
} }
TEST(StableBweExperimentTest, EnabledWithHysteresis) { TEST(StableBweExperimentTest, EnabledWithHysteresis) {
webrtc::test::ScopedFieldTrials field_trials( ExplicitKeyValueConfig field_trials(
"WebRTC-StableTargetRate/" "WebRTC-StableTargetRate/"
"enabled:true," "enabled:true,"
"video_hysteresis_factor:1.1," "video_hysteresis_factor:1.1,"
"screenshare_hysteresis_factor:1.2/"); "screenshare_hysteresis_factor:1.2/");
StableTargetRateExperiment config = StableTargetRateExperiment config(field_trials);
StableTargetRateExperiment::ParseFromFieldTrials();
EXPECT_TRUE(config.IsEnabled()); EXPECT_TRUE(config.IsEnabled());
EXPECT_EQ(config.GetVideoHysteresisFactor(), 1.1); EXPECT_EQ(config.GetVideoHysteresisFactor(), 1.1);
EXPECT_EQ(config.GetScreenshareHysteresisFactor(), 1.2); EXPECT_EQ(config.GetScreenshareHysteresisFactor(), 1.2);
} }
TEST(StableBweExperimentTest, HysteresisOverrideVideoRateHystersis) { TEST(StableBweExperimentTest, HysteresisOverrideVideoRateHystersis) {
webrtc::test::ScopedFieldTrials field_trials( ExplicitKeyValueConfig field_trials(
"WebRTC-StableTargetRate/" "WebRTC-StableTargetRate/"
"enabled:true," "enabled:true,"
"video_hysteresis_factor:1.1," "video_hysteresis_factor:1.1,"
@ -57,8 +56,7 @@ TEST(StableBweExperimentTest, HysteresisOverrideVideoRateHystersis) {
"WebRTC-VideoRateControl/video_hysteresis:1.3," "WebRTC-VideoRateControl/video_hysteresis:1.3,"
"screenshare_hysteresis:1.4/"); "screenshare_hysteresis:1.4/");
StableTargetRateExperiment config = StableTargetRateExperiment config(field_trials);
StableTargetRateExperiment::ParseFromFieldTrials();
EXPECT_TRUE(config.IsEnabled()); EXPECT_TRUE(config.IsEnabled());
EXPECT_EQ(config.GetVideoHysteresisFactor(), 1.1); EXPECT_EQ(config.GetVideoHysteresisFactor(), 1.1);
EXPECT_EQ(config.GetScreenshareHysteresisFactor(), 1.2); EXPECT_EQ(config.GetScreenshareHysteresisFactor(), 1.2);

View file

@ -719,16 +719,24 @@ if (rtc_build_libvpx) {
"../../api:array_view", "../../api:array_view",
"../../api:field_trials_view", "../../api:field_trials_view",
"../../api/environment:environment_factory", "../../api/environment:environment_factory",
"../../api/video:encoded_image",
"../../api/video:video_bitrate_allocation",
"../../api/video:video_frame", "../../api/video:video_frame",
"../../api/video:video_frame_type",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",
"../../common_video/generic_frame_descriptor",
"../../media:media_constants", "../../media:media_constants",
"../../modules/video_coding:codec_globals_headers",
"../../modules/video_coding:frame_dependencies_calculator", "../../modules/video_coding:frame_dependencies_calculator",
"../../modules/video_coding:video_codec_interface",
"../../modules/video_coding:webrtc_libvpx_interface", "../../modules/video_coding:webrtc_libvpx_interface",
"../../modules/video_coding:webrtc_vp9", "../../modules/video_coding:webrtc_vp9",
"../../rtc_base:checks",
"../../rtc_base:safe_compare", "../../rtc_base:safe_compare",
"//third_party/abseil-cpp/absl/algorithm:container", "//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/base:core_headers", "//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/container:inlined_vector", "//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/strings:string_view",
rtc_libvpx_dir, rtc_libvpx_dir,
] ]
seed_corpus = "corpora/vp9-encoder-references-corpus" seed_corpus = "corpora/vp9-encoder-references-corpus"

View file

@ -10,20 +10,36 @@
#include <stdint.h> #include <stdint.h>
#include <cstddef>
#include <memory>
#include <string>
#include <vector>
#include "absl/algorithm/container.h" #include "absl/algorithm/container.h"
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/container/inlined_vector.h" #include "absl/container/inlined_vector.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h" #include "api/array_view.h"
#include "api/environment/environment_factory.h" #include "api/environment/environment_factory.h"
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "api/video/encoded_image.h"
#include "api/video/i420_buffer.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video/video_codec_type.h"
#include "api/video/video_frame.h" #include "api/video/video_frame.h"
#include "api/video/video_frame_type.h"
#include "api/video_codecs/spatial_layer.h"
#include "api/video_codecs/video_codec.h" #include "api/video_codecs/video_codec.h"
#include "api/video_codecs/video_encoder.h" #include "api/video_codecs/video_encoder.h"
#include "media/base/media_constants.h" #include "common_video/generic_frame_descriptor/generic_frame_info.h"
#include "modules/video_coding/codecs/interface/common_constants.h"
#include "modules/video_coding/codecs/interface/libvpx_interface.h" #include "modules/video_coding/codecs/interface/libvpx_interface.h"
#include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
#include "modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h" #include "modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h"
#include "modules/video_coding/frame_dependencies_calculator.h" #include "modules/video_coding/frame_dependencies_calculator.h"
#include "rtc_base/numerics/safe_compare.h" #include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "rtc_base/checks.h"
#include "test/fuzzers/fuzz_data_helper.h" #include "test/fuzzers/fuzz_data_helper.h"
// Fuzzer simulates various svc configurations and libvpx encoder dropping // Fuzzer simulates various svc configurations and libvpx encoder dropping