From 44ab20021dba6d25e5b62877fda15ca71abdf481 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Wed, 17 Apr 2024 12:11:29 +0200 Subject: [PATCH] In EncoderStreamFactory pass field trials as required parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of passing it as optional parameter during construction, pass field trials as required parameters on use. Test that create the EncoderStreamFactory might not have an easy access to the actual field trials, but prod code has appropriate field trials when uses the factory. This way EncoderStreamFactory doesn't need to depend on global field trial string through FieldTrialBaseConfig class. Bug: webrtc:10335 Change-Id: I8f7030e41579ff2c5dd362c491a4e1624b23e690 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347700 Reviewed-by: Erik SprÃ¥ng Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/main@{#42098} --- call/call_perf_tests.cc | 1 + call/rampup_tests.cc | 1 + media/engine/fake_webrtc_call.cc | 33 +++++++++---------- test/encoder_settings.cc | 1 + test/encoder_settings.h | 1 + video/config/BUILD.gn | 2 +- video/config/encoder_stream_factory.cc | 33 ++++++++----------- video/config/encoder_stream_factory.h | 15 +++------ .../config/encoder_stream_factory_unittest.cc | 18 ++++++---- video/config/video_encoder_config.h | 2 ++ video/end_to_end_tests/rtp_rtcp_tests.cc | 1 + video/screenshare_loopback.cc | 9 ++--- video/sv_loopback.cc | 17 +++++----- video/video_loopback.cc | 9 ++--- video/video_quality_test.cc | 6 ++-- video/video_quality_test.h | 2 +- video/video_send_stream_tests.cc | 1 + video/video_stream_encoder.cc | 20 +++++------ video/video_stream_encoder_unittest.cc | 1 + 19 files changed, 87 insertions(+), 86 deletions(-) diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc index e4db74d2fb..0df31c42f3 100644 --- a/call/call_perf_tests.cc +++ b/call/call_perf_tests.cc @@ -795,6 +795,7 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) { private: std::vector CreateEncoderStreams( + const FieldTrialsView& /*field_trials*/, int frame_width, int frame_height, const webrtc::VideoEncoderConfig& encoder_config) override { diff --git a/call/rampup_tests.cc b/call/rampup_tests.cc index 66553f2674..d93065fe12 100644 --- a/call/rampup_tests.cc +++ b/call/rampup_tests.cc @@ -133,6 +133,7 @@ class RampUpTester::VideoStreamFactory private: std::vector CreateEncoderStreams( + const FieldTrialsView& /*field_trials*/, int frame_width, int frame_height, const VideoEncoderConfig& encoder_config) override { diff --git a/media/engine/fake_webrtc_call.cc b/media/engine/fake_webrtc_call.cc index 8ca7880782..d4c6b23767 100644 --- a/media/engine/fake_webrtc_call.cc +++ b/media/engine/fake_webrtc_call.cc @@ -251,20 +251,18 @@ void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { // Note: only tests set their own EncoderStreamFactory... video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams( - frame.width(), frame.height(), encoder_config_); + env_.field_trials(), frame.width(), frame.height(), + encoder_config_); } else { webrtc::VideoEncoder::EncoderInfo encoder_info; - rtc::scoped_refptr< - webrtc::VideoEncoderConfig::VideoStreamFactoryInterface> - factory = rtc::make_ref_counted( - encoder_config_.video_format.name, encoder_config_.max_qp, - encoder_config_.content_type == - webrtc::VideoEncoderConfig::ContentType::kScreen, - encoder_config_.legacy_conference_mode, encoder_info, - absl::nullopt, &env_.field_trials()); + auto factory = rtc::make_ref_counted( + encoder_config_.video_format.name, encoder_config_.max_qp, + encoder_config_.content_type == + webrtc::VideoEncoderConfig::ContentType::kScreen, + encoder_config_.legacy_conference_mode, encoder_info); video_streams_ = factory->CreateEncoderStreams( - frame.width(), frame.height(), encoder_config_); + env_.field_trials(), frame.width(), frame.height(), encoder_config_); } } last_frame_ = frame; @@ -297,17 +295,16 @@ void FakeVideoSendStream::ReconfigureVideoEncoder( if (config.video_stream_factory) { // Note: only tests set their own EncoderStreamFactory... video_streams_ = config.video_stream_factory->CreateEncoderStreams( - width, height, config); + env_.field_trials(), width, height, config); } else { webrtc::VideoEncoder::EncoderInfo encoder_info; - rtc::scoped_refptr - factory = rtc::make_ref_counted( - config.video_format.name, config.max_qp, - config.content_type == - webrtc::VideoEncoderConfig::ContentType::kScreen, - config.legacy_conference_mode, encoder_info); + auto factory = rtc::make_ref_counted( + config.video_format.name, config.max_qp, + config.content_type == webrtc::VideoEncoderConfig::ContentType::kScreen, + config.legacy_conference_mode, encoder_info); - video_streams_ = factory->CreateEncoderStreams(width, height, config); + video_streams_ = factory->CreateEncoderStreams(env_.field_trials(), width, + height, config); } if (config.encoder_specific_settings != nullptr) { diff --git a/test/encoder_settings.cc b/test/encoder_settings.cc index f5b298b107..d52f5a7a16 100644 --- a/test/encoder_settings.cc +++ b/test/encoder_settings.cc @@ -106,6 +106,7 @@ std::vector CreateVideoStreams( DefaultVideoStreamFactory::DefaultVideoStreamFactory() {} std::vector DefaultVideoStreamFactory::CreateEncoderStreams( + const FieldTrialsView& /*field_trials*/, int frame_width, int frame_height, const webrtc::VideoEncoderConfig& encoder_config) { diff --git a/test/encoder_settings.h b/test/encoder_settings.h index 6dbad0fee2..aa3954a381 100644 --- a/test/encoder_settings.h +++ b/test/encoder_settings.h @@ -35,6 +35,7 @@ class DefaultVideoStreamFactory private: std::vector CreateEncoderStreams( + const FieldTrialsView& field_trials, int frame_width, int frame_height, const webrtc::VideoEncoderConfig& encoder_config) override; diff --git a/video/config/BUILD.gn b/video/config/BUILD.gn index 2ced656d0c..09a7637f2f 100644 --- a/video/config/BUILD.gn +++ b/video/config/BUILD.gn @@ -19,7 +19,6 @@ rtc_library("streams_config") { deps = [ ":encoder_config", "../../api:field_trials_view", - "../../api/transport:field_trial_based_config", "../../api/units:data_rate", "../../api/video:video_codec_constants", "../../api/video_codecs:video_codecs_api", @@ -50,6 +49,7 @@ rtc_library("encoder_config") { ] deps = [ + "../../api:field_trials_view", "../../api:scoped_refptr", "../../api/video:resolution", "../../api/video_codecs:scalability_mode", diff --git a/video/config/encoder_stream_factory.cc b/video/config/encoder_stream_factory.cc index 499fdb5b1c..733e398cf2 100644 --- a/video/config/encoder_stream_factory.cc +++ b/video/config/encoder_stream_factory.cc @@ -17,6 +17,7 @@ #include "absl/algorithm/container.h" #include "absl/strings/match.h" +#include "api/field_trials_view.h" #include "api/video/video_codec_constants.h" #include "media/base/media_constants.h" #include "media/base/video_adapter.h" @@ -29,6 +30,8 @@ namespace cricket { namespace { +using ::webrtc::FieldTrialsView; + const int kMinLayerSize = 16; int ScaleDownResolution(int resolution, @@ -99,35 +102,23 @@ static int GetMaxDefaultVideoBitrateKbps(int width, // TODO(bugs.webrtc.org/8785): Consider removing max_qp as member of // EncoderStreamFactory and instead set this value individually for each stream // in the VideoEncoderConfig.simulcast_layers. -EncoderStreamFactory::EncoderStreamFactory(std::string codec_name, - int max_qp, - bool is_screenshare, - bool conference_mode) - : codec_name_(codec_name), - max_qp_(max_qp), - is_screenshare_(is_screenshare), - conference_mode_(conference_mode), - trials_(fallback_trials_), - encoder_info_requested_resolution_alignment_(1) {} - EncoderStreamFactory::EncoderStreamFactory( std::string codec_name, int max_qp, bool is_screenshare, bool conference_mode, const webrtc::VideoEncoder::EncoderInfo& encoder_info, - absl::optional restrictions, - const webrtc::FieldTrialsView* trials) + absl::optional restrictions) : codec_name_(codec_name), max_qp_(max_qp), is_screenshare_(is_screenshare), conference_mode_(conference_mode), - trials_(trials ? *trials : fallback_trials_), encoder_info_requested_resolution_alignment_( encoder_info.requested_resolution_alignment), restrictions_(restrictions) {} std::vector EncoderStreamFactory::CreateEncoderStreams( + const FieldTrialsView& trials, int frame_width, int frame_height, const webrtc::VideoEncoderConfig& encoder_config) { @@ -136,7 +127,7 @@ std::vector EncoderStreamFactory::CreateEncoderStreams( encoder_config.number_of_streams); const absl::optional experimental_min_bitrate = - GetExperimentalMinVideoBitrate(trials_, encoder_config.codec_type); + GetExperimentalMinVideoBitrate(trials, encoder_config.codec_type); bool is_simulcast = (encoder_config.number_of_streams > 1); // If scalability mode was specified, don't treat {active,inactive,inactive} @@ -159,7 +150,8 @@ std::vector EncoderStreamFactory::CreateEncoderStreams( absl::EqualsIgnoreCase(codec_name_, kH264CodecName)) && is_screenshare_ && conference_mode_)) { return CreateSimulcastOrConferenceModeScreenshareStreams( - frame_width, frame_height, encoder_config, experimental_min_bitrate); + trials, frame_width, frame_height, encoder_config, + experimental_min_bitrate); } return CreateDefaultVideoStreams(frame_width, frame_height, encoder_config, @@ -307,6 +299,7 @@ EncoderStreamFactory::CreateDefaultVideoStreams( std::vector EncoderStreamFactory::CreateSimulcastOrConferenceModeScreenshareStreams( + const FieldTrialsView& trials, int width, int height, const webrtc::VideoEncoderConfig& encoder_config, @@ -320,7 +313,7 @@ EncoderStreamFactory::CreateSimulcastOrConferenceModeScreenshareStreams( encoder_config.number_of_streams, width, height, encoder_config.bitrate_priority, max_qp_, is_screenshare_ && conference_mode_, - temporal_layers_supported, trials_, + temporal_layers_supported, trials, encoder_config.codec_type); // Allow an experiment to override the minimum bitrate for the lowest // spatial layer. The experiment's configuration has the lowest priority. @@ -340,18 +333,18 @@ EncoderStreamFactory::CreateSimulcastOrConferenceModeScreenshareStreams( default_scale_factors_used = IsScaleFactorsPowerOfTwo(encoder_config); } const bool norm_size_configured = - webrtc::NormalizeSimulcastSizeExperiment::GetBase2Exponent(trials_) + webrtc::NormalizeSimulcastSizeExperiment::GetBase2Exponent(trials) .has_value(); const int normalized_width = (default_scale_factors_used || norm_size_configured) && (width >= kMinLayerSize) - ? NormalizeSimulcastSize(trials_, width, + ? NormalizeSimulcastSize(trials, width, encoder_config.number_of_streams) : width; const int normalized_height = (default_scale_factors_used || norm_size_configured) && (height >= kMinLayerSize) - ? NormalizeSimulcastSize(trials_, height, + ? NormalizeSimulcastSize(trials, height, encoder_config.number_of_streams) : height; for (size_t i = 0; i < layers.size(); ++i) { diff --git a/video/config/encoder_stream_factory.h b/video/config/encoder_stream_factory.h index 37abb93876..92e440313e 100644 --- a/video/config/encoder_stream_factory.h +++ b/video/config/encoder_stream_factory.h @@ -13,7 +13,7 @@ #include #include -#include "api/transport/field_trial_based_config.h" +#include "api/field_trials_view.h" #include "api/units/data_rate.h" #include "api/video_codecs/video_encoder.h" #include "call/adaptation/video_source_restrictions.h" @@ -24,22 +24,16 @@ namespace cricket { class EncoderStreamFactory : public webrtc::VideoEncoderConfig::VideoStreamFactoryInterface { public: - // Note: this constructor is used by testcase in downstream. - EncoderStreamFactory(std::string codec_name, - int max_qp, - bool is_screenshare, - bool conference_mode); - EncoderStreamFactory(std::string codec_name, int max_qp, bool is_screenshare, bool conference_mode, const webrtc::VideoEncoder::EncoderInfo& encoder_info, absl::optional - restrictions = absl::nullopt, - const webrtc::FieldTrialsView* trials = nullptr); + restrictions = absl::nullopt); std::vector CreateEncoderStreams( + const webrtc::FieldTrialsView& trials, int width, int height, const webrtc::VideoEncoderConfig& encoder_config) override; @@ -53,6 +47,7 @@ class EncoderStreamFactory std::vector CreateSimulcastOrConferenceModeScreenshareStreams( + const webrtc::FieldTrialsView& trials, int width, int height, const webrtc::VideoEncoderConfig& encoder_config, @@ -69,8 +64,6 @@ class EncoderStreamFactory // Allows a screenshare specific configuration, which enables temporal // layering and various settings. const bool conference_mode_; - const webrtc::FieldTrialBasedConfig fallback_trials_; - const webrtc::FieldTrialsView& trials_; const int encoder_info_requested_resolution_alignment_; const absl::optional restrictions_; }; diff --git a/video/config/encoder_stream_factory_unittest.cc b/video/config/encoder_stream_factory_unittest.cc index b37b300c96..811b877680 100644 --- a/video/config/encoder_stream_factory_unittest.cc +++ b/video/config/encoder_stream_factory_unittest.cc @@ -11,15 +11,17 @@ #include "video/config/encoder_stream_factory.h" #include "call/adaptation/video_source_restrictions.h" +#include "test/explicit_key_value_config.h" #include "test/gtest.h" namespace webrtc { - -using cricket::EncoderStreamFactory; -constexpr int kMaxQp = 48; - namespace { +using ::cricket::EncoderStreamFactory; +using test::ExplicitKeyValueConfig; + +constexpr int kMaxQp = 48; + std::vector GetStreamResolutions( const std::vector& streams) { std::vector res; @@ -41,6 +43,7 @@ VideoStream LayerWithRequestedResolution(Resolution res) { } // namespace TEST(EncoderStreamFactory, SinglecastRequestedResolution) { + ExplicitKeyValueConfig field_trials(""); VideoEncoder::EncoderInfo encoder_info; auto factory = rtc::make_ref_counted( "VP8", kMaxQp, @@ -50,7 +53,8 @@ TEST(EncoderStreamFactory, SinglecastRequestedResolution) { encoder_config.number_of_streams = 1; encoder_config.simulcast_layers.push_back( LayerWithRequestedResolution({.width = 640, .height = 360})); - auto streams = factory->CreateEncoderStreams(1280, 720, encoder_config); + auto streams = + factory->CreateEncoderStreams(field_trials, 1280, 720, encoder_config); EXPECT_EQ(streams[0].requested_resolution, (Resolution{.width = 640, .height = 360})); EXPECT_EQ(GetStreamResolutions(streams), (std::vector{ @@ -59,6 +63,7 @@ TEST(EncoderStreamFactory, SinglecastRequestedResolution) { } TEST(EncoderStreamFactory, SinglecastRequestedResolutionWithAdaptation) { + ExplicitKeyValueConfig field_trials(""); VideoSourceRestrictions restrictions( /* max_pixels_per_frame= */ (320 * 320), /* target_pixels_per_frame= */ absl::nullopt, @@ -72,7 +77,8 @@ TEST(EncoderStreamFactory, SinglecastRequestedResolutionWithAdaptation) { encoder_config.number_of_streams = 1; encoder_config.simulcast_layers.push_back( LayerWithRequestedResolution({.width = 640, .height = 360})); - auto streams = factory->CreateEncoderStreams(1280, 720, encoder_config); + auto streams = + factory->CreateEncoderStreams(field_trials, 1280, 720, encoder_config); EXPECT_EQ(streams[0].requested_resolution, (Resolution{.width = 640, .height = 360})); EXPECT_EQ(GetStreamResolutions(streams), (std::vector{ diff --git a/video/config/video_encoder_config.h b/video/config/video_encoder_config.h index cb0644a7fd..a29af1fe06 100644 --- a/video/config/video_encoder_config.h +++ b/video/config/video_encoder_config.h @@ -17,6 +17,7 @@ #include #include "absl/types/optional.h" +#include "api/field_trials_view.h" #include "api/scoped_refptr.h" #include "api/video/resolution.h" #include "api/video_codecs/scalability_mode.h" @@ -145,6 +146,7 @@ class VideoEncoderConfig { // The size of the vector may not be larger than // `encoder_config.number_of_streams`. virtual std::vector CreateEncoderStreams( + const FieldTrialsView& field_trials, int frame_width, int frame_height, const VideoEncoderConfig& encoder_config) = 0; diff --git a/video/end_to_end_tests/rtp_rtcp_tests.cc b/video/end_to_end_tests/rtp_rtcp_tests.cc index dc7c686d57..35507e57b0 100644 --- a/video/end_to_end_tests/rtp_rtcp_tests.cc +++ b/video/end_to_end_tests/rtp_rtcp_tests.cc @@ -142,6 +142,7 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation( private: std::vector CreateEncoderStreams( + const FieldTrialsView& /*field_trials*/, int frame_width, int frame_height, const VideoEncoderConfig& encoder_config) override { diff --git a/video/screenshare_loopback.cc b/video/screenshare_loopback.cc index 21aae1f7b8..607a5d54f4 100644 --- a/video/screenshare_loopback.cc +++ b/video/screenshare_loopback.cc @@ -362,15 +362,16 @@ void Loopback() { std::vector SL_descriptors; SL_descriptors.push_back(SL0()); SL_descriptors.push_back(SL1()); - VideoQualityTest::FillScalabilitySettings( + + VideoQualityTest fixture(nullptr); + fixture.FillScalabilitySettings( ¶ms, 0, stream_descriptors, NumStreams(), SelectedStream(), NumSpatialLayers(), SelectedSL(), InterLayerPred(), SL_descriptors); - auto fixture = std::make_unique(nullptr); if (DurationSecs()) { - fixture->RunWithAnalyzer(params); + fixture.RunWithAnalyzer(params); } else { - fixture->RunWithRenderers(params); + fixture.RunWithRenderers(params); } } diff --git a/video/sv_loopback.cc b/video/sv_loopback.cc index 2a8f9743e8..b0a90a017d 100644 --- a/video/sv_loopback.cc +++ b/video/sv_loopback.cc @@ -664,13 +664,15 @@ void Loopback() { params.ss[screenshare_idx].infer_streams = true; } + VideoQualityTest fixture(nullptr); + std::vector stream_descriptors; stream_descriptors.push_back(ScreenshareStream0()); stream_descriptors.push_back(ScreenshareStream1()); std::vector SL_descriptors; SL_descriptors.push_back(ScreenshareSL0()); SL_descriptors.push_back(ScreenshareSL1()); - VideoQualityTest::FillScalabilitySettings( + fixture.FillScalabilitySettings( ¶ms, screenshare_idx, stream_descriptors, ScreenshareNumStreams(), ScreenshareSelectedStream(), ScreenshareNumSpatialLayers(), ScreenshareSelectedSL(), ScreenshareInterLayerPred(), SL_descriptors); @@ -681,16 +683,15 @@ void Loopback() { SL_descriptors.clear(); SL_descriptors.push_back(VideoSL0()); SL_descriptors.push_back(VideoSL1()); - VideoQualityTest::FillScalabilitySettings( - ¶ms, camera_idx, stream_descriptors, VideoNumStreams(), - VideoSelectedStream(), VideoNumSpatialLayers(), VideoSelectedSL(), - VideoInterLayerPred(), SL_descriptors); + fixture.FillScalabilitySettings(¶ms, camera_idx, stream_descriptors, + VideoNumStreams(), VideoSelectedStream(), + VideoNumSpatialLayers(), VideoSelectedSL(), + VideoInterLayerPred(), SL_descriptors); - auto fixture = std::make_unique(nullptr); if (DurationSecs()) { - fixture->RunWithAnalyzer(params); + fixture.RunWithAnalyzer(params); } else { - fixture->RunWithRenderers(params); + fixture.RunWithRenderers(params); } } } // namespace webrtc diff --git a/video/video_loopback.cc b/video/video_loopback.cc index 826936b2d6..50c6f2b992 100644 --- a/video/video_loopback.cc +++ b/video/video_loopback.cc @@ -418,15 +418,16 @@ void Loopback() { SL_descriptors.push_back(SL0()); SL_descriptors.push_back(SL1()); SL_descriptors.push_back(SL2()); - VideoQualityTest::FillScalabilitySettings( + + VideoQualityTest fixture(nullptr); + fixture.FillScalabilitySettings( ¶ms, 0, stream_descriptors, NumStreams(), SelectedStream(), NumSpatialLayers(), SelectedSL(), InterLayerPred(), SL_descriptors); - auto fixture = std::make_unique(nullptr); if (DurationSecs()) { - fixture->RunWithAnalyzer(params); + fixture.RunWithAnalyzer(params); } else { - fixture->RunWithRenderers(params); + fixture.RunWithRenderers(params); } } diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc index b6cc76550e..28bdca9a09 100644 --- a/video/video_quality_test.cc +++ b/video/video_quality_test.cc @@ -106,6 +106,7 @@ class VideoStreamFactory private: std::vector CreateEncoderStreams( + const FieldTrialsView& /*field_trials*/, int frame_width, int frame_height, const VideoEncoderConfig& encoder_config) override { @@ -591,7 +592,6 @@ VideoStream VideoQualityTest::DefaultThumbnailStream() { return stream; } -// Static. void VideoQualityTest::FillScalabilitySettings( Params* params, size_t video_idx, @@ -624,8 +624,8 @@ void VideoQualityTest::FillScalabilitySettings( params->screenshare[video_idx].enabled, true, encoder_info); params->ss[video_idx].streams = encoder_config.video_stream_factory->CreateEncoderStreams( - params->video[video_idx].width, params->video[video_idx].height, - encoder_config); + env().field_trials(), params->video[video_idx].width, + params->video[video_idx].height, encoder_config); } else { // Read VideoStream and SpatialLayer elements from a list of comma separated // lists. To use a default value for an element, use -1 or leave empty. diff --git a/video/video_quality_test.h b/video/video_quality_test.h index 508a7ac481..fb4ae1662c 100644 --- a/video/video_quality_test.h +++ b/video/video_quality_test.h @@ -49,7 +49,7 @@ class VideoQualityTest : public test::CallTest, return payload_type_map_; } - static void FillScalabilitySettings( + void FillScalabilitySettings( Params* params, size_t video_idx, const std::vector& stream_descriptors, diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc index 29230cb7bf..c96f5d39e2 100644 --- a/video/video_send_stream_tests.cc +++ b/video/video_send_stream_tests.cc @@ -2606,6 +2606,7 @@ TEST_F(VideoSendStreamTest, TranslatesTwoLayerScreencastToTargetBitrate) { private: std::vector CreateEncoderStreams( + const FieldTrialsView& /*field_trials*/, int frame_width, int frame_height, const VideoEncoderConfig& encoder_config) override { diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 5ed5110c96..14206e402b 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -1018,19 +1018,19 @@ void VideoStreamEncoder::ReconfigureEncoder() { if (encoder_config_.video_stream_factory) { // Note: only tests set their own EncoderStreamFactory... streams = encoder_config_.video_stream_factory->CreateEncoderStreams( - last_frame_info_->width, last_frame_info_->height, encoder_config_); + env_.field_trials(), last_frame_info_->width, last_frame_info_->height, + encoder_config_); } else { - rtc::scoped_refptr - factory = rtc::make_ref_counted( - encoder_config_.video_format.name, encoder_config_.max_qp, - encoder_config_.content_type == - webrtc::VideoEncoderConfig::ContentType::kScreen, - encoder_config_.legacy_conference_mode, encoder_->GetEncoderInfo(), - MergeRestrictions({latest_restrictions_, animate_restrictions_}), - &env_.field_trials()); + auto factory = rtc::make_ref_counted( + encoder_config_.video_format.name, encoder_config_.max_qp, + encoder_config_.content_type == + webrtc::VideoEncoderConfig::ContentType::kScreen, + encoder_config_.legacy_conference_mode, encoder_->GetEncoderInfo(), + MergeRestrictions({latest_restrictions_, animate_restrictions_})); streams = factory->CreateEncoderStreams( - last_frame_info_->width, last_frame_info_->height, encoder_config_); + env_.field_trials(), last_frame_info_->width, last_frame_info_->height, + encoder_config_); } // TODO(webrtc:14451) : Move AlignmentAdjuster into EncoderStreamFactory diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc index d5989077fe..061419c061 100644 --- a/video/video_stream_encoder_unittest.cc +++ b/video/video_stream_encoder_unittest.cc @@ -516,6 +516,7 @@ class CroppingVideoStreamFactory private: std::vector CreateEncoderStreams( + const FieldTrialsView& /*field_trials*/, int frame_width, int frame_height, const VideoEncoderConfig& encoder_config) override {