diff --git a/api/test/mock_video_bitrate_allocator_factory.h b/api/test/mock_video_bitrate_allocator_factory.h index 7c6492ed4e..16af191970 100644 --- a/api/test/mock_video_bitrate_allocator_factory.h +++ b/api/test/mock_video_bitrate_allocator_factory.h @@ -18,12 +18,13 @@ namespace webrtc { -class MockVideoBitrateAllocatorFactory : public VideoBitrateAllocatorFactory { +class MockVideoBitrateAllocatorFactory + : public webrtc::VideoBitrateAllocatorFactory { public: ~MockVideoBitrateAllocatorFactory() override { Die(); } MOCK_METHOD(std::unique_ptr, - Create, - (const Environment&, const VideoCodec&), + CreateVideoBitrateAllocator, + (const VideoCodec&), (override)); MOCK_METHOD(void, Die, ()); }; diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn index 48b13c90e3..72befb522c 100644 --- a/api/video/BUILD.gn +++ b/api/video/BUILD.gn @@ -264,8 +264,6 @@ rtc_source_set("video_bitrate_allocator_factory") { sources = [ "video_bitrate_allocator_factory.h" ] deps = [ ":video_bitrate_allocator", - "../../rtc_base:checks", - "../environment", "../video_codecs:video_codecs_api", ] } diff --git a/api/video/builtin_video_bitrate_allocator_factory.cc b/api/video/builtin_video_bitrate_allocator_factory.cc index 108871387d..252ae210b6 100644 --- a/api/video/builtin_video_bitrate_allocator_factory.cc +++ b/api/video/builtin_video_bitrate_allocator_factory.cc @@ -29,10 +29,7 @@ class BuiltinVideoBitrateAllocatorFactory BuiltinVideoBitrateAllocatorFactory() = default; ~BuiltinVideoBitrateAllocatorFactory() override = default; - // TODO: bugs.webrtc.org/42220378 - propagate Environment into RateAllocators - // so that they wouldn't use global field trials string to query field trials. - std::unique_ptr Create( - const Environment& /*env*/, + std::unique_ptr CreateVideoBitrateAllocator( const VideoCodec& codec) override { // TODO(https://crbug.com/webrtc/14884): Update SvcRateAllocator to // support simulcast and use it for VP9/AV1 simulcast as well. diff --git a/api/video/video_bitrate_allocator_factory.h b/api/video/video_bitrate_allocator_factory.h index a6e0a1aef0..cb34ebb5e1 100644 --- a/api/video/video_bitrate_allocator_factory.h +++ b/api/video/video_bitrate_allocator_factory.h @@ -13,10 +13,8 @@ #include -#include "api/environment/environment.h" #include "api/video/video_bitrate_allocator.h" #include "api/video_codecs/video_codec.h" -#include "rtc_base/checks.h" namespace webrtc { @@ -25,19 +23,9 @@ namespace webrtc { class VideoBitrateAllocatorFactory { public: virtual ~VideoBitrateAllocatorFactory() = default; - // Creates a VideoBitrateAllocator for a specific video codec. - virtual std::unique_ptr Create( - const Environment& env, - const VideoCodec& codec) { - return CreateVideoBitrateAllocator(codec); - } virtual std::unique_ptr CreateVideoBitrateAllocator( - const VideoCodec& codec) { - // Newer code shouldn't call this function, - // Older code should implement it in derived classes. - RTC_CHECK_NOTREACHED(); - } + const VideoCodec& codec) = 0; }; } // namespace webrtc diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc index 6debc132b3..f8612f88a1 100644 --- a/media/engine/webrtc_video_engine_unittest.cc +++ b/media/engine/webrtc_video_engine_unittest.cc @@ -1363,9 +1363,9 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) { std::unique_ptr rate_allocator_factory = std::make_unique(); - EXPECT_CALL( - *rate_allocator_factory, - Create(_, Field(&webrtc::VideoCodec::codecType, webrtc::kVideoCodecVP8))) + EXPECT_CALL(*rate_allocator_factory, + CreateVideoBitrateAllocator(Field(&webrtc::VideoCodec::codecType, + webrtc::kVideoCodecVP8))) .WillOnce( [] { return std::make_unique(); }); webrtc::FieldTrialBasedConfig trials; diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index 1b3a2442a1..d2246d5c25 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -1204,7 +1204,6 @@ if (rtc_include_tests) { "../../api:scoped_refptr", "../../api:simulcast_test_fixture_api", "../../api:videocodec_test_fixture_api", - "../../api/environment", "../../api/environment:environment_factory", "../../api/task_queue", "../../api/task_queue:default_task_queue_factory", diff --git a/modules/video_coding/codecs/test/video_codec_test.cc b/modules/video_coding/codecs/test/video_codec_test.cc index 89c387abb0..e7a7f7504c 100644 --- a/modules/video_coding/codecs/test/video_codec_test.cc +++ b/modules/video_coding/codecs/test/video_codec_test.cc @@ -319,7 +319,7 @@ TEST_P(SpatialQualityTest, SpatialQuality) { VideoSourceSettings source_settings = ToSourceSettings(video_info); EncodingSettings encoding_settings = VideoCodecTester::CreateEncodingSettings( - env, codec_type, /*scalability_mode=*/"L1T1", width, height, + codec_type, /*scalability_mode=*/"L1T1", width, height, {DataRate::KilobitsPerSec(bitrate_kbps)}, Frequency::Hertz(framerate_fps)); @@ -398,14 +398,14 @@ TEST_P(BitrateAdaptationTest, BitrateAdaptation) { VideoSourceSettings source_settings = ToSourceSettings(video_info); EncodingSettings encoding_settings = VideoCodecTester::CreateEncodingSettings( - env, codec_type, /*scalability_mode=*/"L1T1", + codec_type, /*scalability_mode=*/"L1T1", /*width=*/640, /*height=*/360, {DataRate::KilobitsPerSec(bitrate_kbps.first)}, /*framerate=*/Frequency::Hertz(30)); EncodingSettings encoding_settings2 = VideoCodecTester::CreateEncodingSettings( - env, codec_type, /*scalability_mode=*/"L1T1", + codec_type, /*scalability_mode=*/"L1T1", /*width=*/640, /*height=*/360, {DataRate::KilobitsPerSec(bitrate_kbps.second)}, /*framerate=*/Frequency::Hertz(30)); @@ -484,14 +484,14 @@ TEST_P(FramerateAdaptationTest, FramerateAdaptation) { VideoSourceSettings source_settings = ToSourceSettings(video_info); EncodingSettings encoding_settings = VideoCodecTester::CreateEncodingSettings( - env, codec_type, /*scalability_mode=*/"L1T1", + codec_type, /*scalability_mode=*/"L1T1", /*width=*/640, /*height=*/360, /*bitrate=*/{DataRate::KilobitsPerSec(512)}, Frequency::Hertz(framerate_fps.first)); EncodingSettings encoding_settings2 = VideoCodecTester::CreateEncodingSettings( - env, codec_type, /*scalability_mode=*/"L1T1", + codec_type, /*scalability_mode=*/"L1T1", /*width=*/640, /*height=*/360, /*bitrate=*/{DataRate::KilobitsPerSec(512)}, Frequency::Hertz(framerate_fps.second)); @@ -571,7 +571,7 @@ TEST(VideoCodecTest, DISABLED_EncodeDecode) { .value_or(absl::GetFlag(FLAGS_input_framerate_fps))); EncodingSettings encoding_settings = VideoCodecTester::CreateEncodingSettings( - env, CodecNameToCodecType(absl::GetFlag(FLAGS_encoder)), + CodecNameToCodecType(absl::GetFlag(FLAGS_encoder)), absl::GetFlag(FLAGS_scalability_mode), absl::GetFlag(FLAGS_width).value_or(absl::GetFlag(FLAGS_input_width)), absl::GetFlag(FLAGS_height).value_or(absl::GetFlag(FLAGS_input_height)), diff --git a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc index 9c708263a7..a4c5045e63 100644 --- a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc +++ b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc @@ -446,7 +446,6 @@ VideoCodecTestFixtureImpl::VideoCodecTestFixtureImpl(Config config) webrtc::LibvpxVp9DecoderTemplateAdapter, webrtc::OpenH264DecoderTemplateAdapter, webrtc::Dav1dDecoderTemplateAdapter>>()), - env_(CreateEnvironment()), config_(config) {} VideoCodecTestFixtureImpl::VideoCodecTestFixtureImpl( @@ -455,7 +454,6 @@ VideoCodecTestFixtureImpl::VideoCodecTestFixtureImpl( std::unique_ptr encoder_factory) : encoder_factory_(std::move(encoder_factory)), decoder_factory_(std::move(decoder_factory)), - env_(CreateEnvironment()), config_(config) {} VideoCodecTestFixtureImpl::~VideoCodecTestFixtureImpl() = default; @@ -697,6 +695,8 @@ void VideoCodecTestFixtureImpl::VerifyVideoStatistic( } bool VideoCodecTestFixtureImpl::CreateEncoderAndDecoder() { + const Environment env = CreateEnvironment(); + SdpVideoFormat encoder_format(CreateSdpVideoFormat(config_)); SdpVideoFormat decoder_format = encoder_format; @@ -711,7 +711,7 @@ bool VideoCodecTestFixtureImpl::CreateEncoderAndDecoder() { decoder_format = *config_.decoder_format; } - encoder_ = encoder_factory_->Create(env_, encoder_format); + encoder_ = encoder_factory_->Create(env, encoder_format); EXPECT_TRUE(encoder_) << "Encoder not successfully created."; if (encoder_ == nullptr) { return false; @@ -721,7 +721,7 @@ bool VideoCodecTestFixtureImpl::CreateEncoderAndDecoder() { config_.NumberOfSimulcastStreams(), config_.NumberOfSpatialLayers()); for (size_t i = 0; i < num_simulcast_or_spatial_layers; ++i) { std::unique_ptr decoder = - decoder_factory_->Create(env_, decoder_format); + decoder_factory_->Create(env, decoder_format); EXPECT_TRUE(decoder) << "Decoder not successfully created."; if (decoder == nullptr) { return false; @@ -818,7 +818,7 @@ bool VideoCodecTestFixtureImpl::SetUpAndInitObjects( task_queue->SendTask([this]() { processor_ = std::make_unique( - env_, encoder_.get(), &decoders_, source_frame_reader_.get(), config_, + encoder_.get(), &decoders_, source_frame_reader_.get(), config_, &stats_, &encoded_frame_writers_, decoded_frame_writers_.empty() ? nullptr : &decoded_frame_writers_); }); diff --git a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.h b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.h index 088e7b70b0..005b7c0a8e 100644 --- a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.h +++ b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.h @@ -15,7 +15,6 @@ #include #include -#include "api/environment/environment.h" #include "api/test/videocodec_test_fixture.h" #include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_encoder_factory.h" @@ -93,7 +92,6 @@ class VideoCodecTestFixtureImpl : public VideoCodecTestFixture { VideoProcessor::VideoDecoderList decoders_; // Helper objects. - const Environment env_; Config config_; VideoCodecTestStatsImpl stats_; std::unique_ptr source_frame_reader_; diff --git a/modules/video_coding/codecs/test/videoprocessor.cc b/modules/video_coding/codecs/test/videoprocessor.cc index c5e7ed0ebb..15a51e0dda 100644 --- a/modules/video_coding/codecs/test/videoprocessor.cc +++ b/modules/video_coding/codecs/test/videoprocessor.cc @@ -135,8 +135,7 @@ void CalculateFrameQuality(const I420BufferInterface& ref_buffer, } // namespace -VideoProcessor::VideoProcessor(const Environment& env, - webrtc::VideoEncoder* encoder, +VideoProcessor::VideoProcessor(webrtc::VideoEncoder* encoder, VideoDecoderList* decoders, FrameReader* input_frame_reader, const VideoCodecTestFixture::Config& config, @@ -151,9 +150,9 @@ VideoProcessor::VideoProcessor(const Environment& env, stats_(stats), encoder_(encoder), decoders_(decoders), - bitrate_allocator_(CreateBuiltinVideoBitrateAllocatorFactory()->Create( - env, - config_.codec_settings)), + bitrate_allocator_( + CreateBuiltinVideoBitrateAllocatorFactory() + ->CreateVideoBitrateAllocator(config_.codec_settings)), encode_callback_(this), input_frame_reader_(input_frame_reader), merged_encoded_frames_(num_simulcast_or_spatial_layers_), diff --git a/modules/video_coding/codecs/test/videoprocessor.h b/modules/video_coding/codecs/test/videoprocessor.h index e6ecdff09f..502fa3d0fa 100644 --- a/modules/video_coding/codecs/test/videoprocessor.h +++ b/modules/video_coding/codecs/test/videoprocessor.h @@ -20,7 +20,6 @@ #include #include "absl/types/optional.h" -#include "api/environment/environment.h" #include "api/sequence_checker.h" #include "api/task_queue/task_queue_base.h" #include "api/test/videocodec_test_fixture.h" @@ -62,8 +61,7 @@ class VideoProcessor { using FrameWriterList = std::vector>; using FrameStatistics = VideoCodecTestStats::FrameStatistics; - VideoProcessor(const Environment& env, - VideoEncoder* encoder, + VideoProcessor(webrtc::VideoEncoder* encoder, VideoDecoderList* decoders, FrameReader* input_frame_reader, const VideoCodecTestFixture::Config& config, diff --git a/modules/video_coding/codecs/test/videoprocessor_unittest.cc b/modules/video_coding/codecs/test/videoprocessor_unittest.cc index 8082542af3..28c369f00a 100644 --- a/modules/video_coding/codecs/test/videoprocessor_unittest.cc +++ b/modules/video_coding/codecs/test/videoprocessor_unittest.cc @@ -12,7 +12,6 @@ #include -#include "api/environment/environment_factory.h" #include "api/scoped_refptr.h" #include "api/test/mock_video_decoder.h" #include "api/test/mock_video_encoder.h" @@ -54,9 +53,8 @@ class VideoProcessorTest : public ::testing::Test { ExpectInit(); q_.SendTask([this] { video_processor_ = std::make_unique( - CreateEnvironment(), &encoder_mock_, &decoders_, &frame_reader_mock_, - config_, &stats_, &encoded_frame_writers_, - /*decoded_frame_writers=*/nullptr); + &encoder_mock_, &decoders_, &frame_reader_mock_, config_, &stats_, + &encoded_frame_writers_, /*decoded_frame_writers=*/nullptr); }); } diff --git a/modules/video_coding/video_codec_initializer_unittest.cc b/modules/video_coding/video_codec_initializer_unittest.cc index 109b095b83..b4858bf634 100644 --- a/modules/video_coding/video_codec_initializer_unittest.cc +++ b/modules/video_coding/video_codec_initializer_unittest.cc @@ -16,8 +16,6 @@ #include #include "absl/types/optional.h" -#include "api/environment/environment.h" -#include "api/environment/environment_factory.h" #include "api/scoped_refptr.h" #include "api/test/mock_fec_controller_override.h" #include "api/video/builtin_video_bitrate_allocator_factory.h" @@ -94,10 +92,10 @@ class VideoCodecInitializerTest : public ::testing::Test { void InitializeCodec() { frame_buffer_controller_.reset(); - codec_out_ = VideoCodecInitializer::SetupCodec(env_.field_trials(), config_, - streams_); - bitrate_allocator_ = - CreateBuiltinVideoBitrateAllocatorFactory()->Create(env_, codec_out_); + codec_out_ = + VideoCodecInitializer::SetupCodec(field_trials_, config_, streams_); + bitrate_allocator_ = CreateBuiltinVideoBitrateAllocatorFactory() + ->CreateVideoBitrateAllocator(codec_out_); RTC_CHECK(bitrate_allocator_); // Make sure temporal layers instances have been created. @@ -139,7 +137,7 @@ class VideoCodecInitializerTest : public ::testing::Test { return stream; } - const Environment env_ = CreateEnvironment(); + const test::ExplicitKeyValueConfig field_trials_{""}; MockFecControllerOverride fec_controller_override_; // Input settings. @@ -507,7 +505,7 @@ TEST_F(VideoCodecInitializerTest, Av1SingleSpatialLayerBitratesAreConsistent) { streams[0].scalability_mode = ScalabilityMode::kL1T2; VideoCodec codec = - VideoCodecInitializer::SetupCodec(env_.field_trials(), config, streams); + VideoCodecInitializer::SetupCodec(field_trials_, config, streams); EXPECT_GE(codec.spatialLayers[0].targetBitrate, codec.spatialLayers[0].minBitrate); @@ -522,7 +520,7 @@ TEST_F(VideoCodecInitializerTest, Av1TwoSpatialLayersBitratesAreConsistent) { streams[0].scalability_mode = ScalabilityMode::kL2T2; VideoCodec codec = - VideoCodecInitializer::SetupCodec(env_.field_trials(), config, streams); + VideoCodecInitializer::SetupCodec(field_trials_, config, streams); EXPECT_GE(codec.spatialLayers[0].targetBitrate, codec.spatialLayers[0].minBitrate); @@ -543,7 +541,7 @@ TEST_F(VideoCodecInitializerTest, Av1TwoSpatialLayersActiveByDefault) { config.spatial_layers = {}; VideoCodec codec = - VideoCodecInitializer::SetupCodec(env_.field_trials(), config, streams); + VideoCodecInitializer::SetupCodec(field_trials_, config, streams); EXPECT_TRUE(codec.spatialLayers[0].active); EXPECT_TRUE(codec.spatialLayers[1].active); @@ -559,7 +557,7 @@ TEST_F(VideoCodecInitializerTest, Av1TwoSpatialLayersOneDeactivated) { config.spatial_layers[1].active = false; VideoCodec codec = - VideoCodecInitializer::SetupCodec(env_.field_trials(), config, streams); + VideoCodecInitializer::SetupCodec(field_trials_, config, streams); EXPECT_TRUE(codec.spatialLayers[0].active); EXPECT_FALSE(codec.spatialLayers[1].active); @@ -577,7 +575,7 @@ TEST_F(VideoCodecInitializerTest, Vp9SingleSpatialLayerBitratesAreConsistent) { streams[0].scalability_mode = ScalabilityMode::kL1T2; VideoCodec codec = - VideoCodecInitializer::SetupCodec(env_.field_trials(), config, streams); + VideoCodecInitializer::SetupCodec(field_trials_, config, streams); EXPECT_EQ(1u, codec.VP9()->numberOfSpatialLayers); // Target is consistent with min and max (min <= target <= max). @@ -605,7 +603,7 @@ TEST_F(VideoCodecInitializerTest, Vp9TwoSpatialLayersBitratesAreConsistent) { streams[0].scalability_mode = ScalabilityMode::kL2T2; VideoCodec codec = - VideoCodecInitializer::SetupCodec(env_.field_trials(), config, streams); + VideoCodecInitializer::SetupCodec(field_trials_, config, streams); EXPECT_EQ(2u, codec.VP9()->numberOfSpatialLayers); EXPECT_GE(codec.spatialLayers[0].targetBitrate, @@ -629,15 +627,14 @@ TEST_F(VideoCodecInitializerTest, UpdatesVp9SpecificFieldsWithScalabilityMode) { streams[0].scalability_mode = ScalabilityMode::kL2T3_KEY; VideoCodec codec = - VideoCodecInitializer::SetupCodec(env_.field_trials(), config, streams); + VideoCodecInitializer::SetupCodec(field_trials_, config, streams); EXPECT_EQ(codec.VP9()->numberOfSpatialLayers, 2u); EXPECT_EQ(codec.VP9()->numberOfTemporalLayers, 3u); EXPECT_EQ(codec.VP9()->interLayerPred, InterLayerPredMode::kOnKeyPic); streams[0].scalability_mode = ScalabilityMode::kS3T1; - codec = - VideoCodecInitializer::SetupCodec(env_.field_trials(), config, streams); + codec = VideoCodecInitializer::SetupCodec(field_trials_, config, streams); EXPECT_EQ(codec.VP9()->numberOfSpatialLayers, 3u); EXPECT_EQ(codec.VP9()->numberOfTemporalLayers, 1u); diff --git a/rtc_tools/video_encoder/video_encoder.cc b/rtc_tools/video_encoder/video_encoder.cc index a48d72a91f..53641b7eda 100644 --- a/rtc_tools/video_encoder/video_encoder.cc +++ b/rtc_tools/video_encoder/video_encoder.cc @@ -333,13 +333,13 @@ class TestVideoEncoderFactoryWrapper final { RTC_CHECK_EQ(ret, WEBRTC_VIDEO_CODEC_OK); // Set bitrates. - std::unique_ptr bitrate_allocator = - CreateBuiltinVideoBitrateAllocatorFactory()->Create( - env, video_codec_setting); - RTC_CHECK(bitrate_allocator); + std::unique_ptr bitrate_allocator_; + bitrate_allocator_ = webrtc::CreateBuiltinVideoBitrateAllocatorFactory() + ->CreateVideoBitrateAllocator(video_codec_setting); + RTC_CHECK(bitrate_allocator_); webrtc::VideoBitrateAllocation allocation = - bitrate_allocator->GetAllocation(bitrate_kbps * 1000, frame_rate_fps); + bitrate_allocator_->GetAllocation(bitrate_kbps * 1000, frame_rate_fps); RTC_LOG(LS_INFO) << allocation.ToString(); video_encoder->SetRates(webrtc::VideoEncoder::RateControlParameters( diff --git a/test/video_codec_tester.cc b/test/video_codec_tester.cc index 8f5feeef04..4c9fc40c62 100644 --- a/test/video_codec_tester.cc +++ b/test/video_codec_tester.cc @@ -1300,8 +1300,7 @@ void SetDefaultCodecSpecificSettings(VideoCodec* vc, int num_temporal_layers) { } std::tuple, ScalabilityMode> -SplitBitrateAndUpdateScalabilityMode(const Environment& env, - std::string codec_type, +SplitBitrateAndUpdateScalabilityMode(std::string codec_type, ScalabilityMode scalability_mode, int width, int height, @@ -1408,7 +1407,8 @@ SplitBitrateAndUpdateScalabilityMode(const Environment& env, } std::unique_ptr bitrate_allocator = - CreateBuiltinVideoBitrateAllocatorFactory()->Create(env, vc); + CreateBuiltinVideoBitrateAllocatorFactory()->CreateVideoBitrateAllocator( + vc); VideoBitrateAllocation bitrate_allocation = bitrate_allocator->Allocate(VideoBitrateAllocationParameters( total_bitrate.bps(), framerate.hertz())); @@ -1486,7 +1486,6 @@ void VideoCodecStats::Stream::LogMetrics( } EncodingSettings VideoCodecTester::CreateEncodingSettings( - const Environment& env, std::string codec_type, std::string scalability_name, int width, @@ -1500,7 +1499,7 @@ EncodingSettings VideoCodecTester::CreateEncodingSettings( auto [adjusted_bitrate, scalability_mode] = SplitBitrateAndUpdateScalabilityMode( - env, codec_type, *ScalabilityModeFromString(scalability_name), width, + codec_type, *ScalabilityModeFromString(scalability_name), width, height, bitrate, framerate, content_type); int num_spatial_layers = ScalabilityModeToNumSpatialLayers(scalability_mode); diff --git a/test/video_codec_tester.h b/test/video_codec_tester.h index 3789f56985..7032cc8520 100644 --- a/test/video_codec_tester.h +++ b/test/video_codec_tester.h @@ -194,8 +194,7 @@ class VideoCodecTester { // and per-temporal layer. If layer bitrates are not explicitly specified, // then the codec-specific rate allocators used to distribute the total // bitrate across spatial or/and temporal layers. - static EncodingSettings CreateEncodingSettings(const Environment& env, - std::string codec_type, + static EncodingSettings CreateEncodingSettings(std::string codec_type, std::string scalability_name, int width, int height, diff --git a/test/video_codec_tester_unittest.cc b/test/video_codec_tester_unittest.cc index ddc2410547..2361d25257 100644 --- a/test/video_codec_tester_unittest.cc +++ b/test/video_codec_tester_unittest.cc @@ -620,7 +620,7 @@ TEST_P(VideoCodecTesterTestPacing, PaceEncode) { })); EncodingSettings encoding_settings = VideoCodecTester::CreateEncodingSettings( - env, "VP8", "L1T1", kSourceWidth, kSourceHeight, {kBitrate}, kFramerate); + "VP8", "L1T1", kSourceWidth, kSourceHeight, {kBitrate}, kFramerate); std::map frame_settings = VideoCodecTester::CreateFrameSettings(encoding_settings, kNumFrames); @@ -687,8 +687,7 @@ class VideoCodecTesterTestEncodingSettings TEST_P(VideoCodecTesterTestEncodingSettings, CreateEncodingSettings) { EncodingSettingsTestParameters test_params = GetParam(); EncodingSettings encoding_settings = VideoCodecTester::CreateEncodingSettings( - CreateEnvironment(), test_params.codec_type, test_params.scalability_mode, - /*width=*/1280, + test_params.codec_type, test_params.scalability_mode, /*width=*/1280, /*height=*/720, test_params.bitrate, kFramerate); const std::map& layers_settings = encoding_settings.layers_settings; diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc index 21698ce4fd..38b21bc025 100644 --- a/video/video_send_stream_tests.cc +++ b/video/video_send_stream_tests.cc @@ -2697,8 +2697,7 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) { CreateBuiltinVideoBitrateAllocatorFactory()) {} private: - std::unique_ptr Create( - const Environment& env, + std::unique_ptr CreateVideoBitrateAllocator( const VideoCodec& codec) override { EXPECT_GE(codec.startBitrate, codec.minBitrate); EXPECT_LE(codec.startBitrate, codec.maxBitrate); @@ -2723,7 +2722,7 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) { ++num_rate_allocator_creations_; create_rate_allocator_event_.Set(); - return bitrate_allocator_factory_->Create(env, codec); + return bitrate_allocator_factory_->CreateVideoBitrateAllocator(codec); } int32_t InitEncode(const VideoCodec* codecSettings, diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 26601b075c..8ae14f197c 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -1267,7 +1267,8 @@ void VideoStreamEncoder::ReconfigureEncoder() { } })); - rate_allocator_ = settings_.bitrate_allocator_factory->Create(env_, codec); + rate_allocator_ = + settings_.bitrate_allocator_factory->CreateVideoBitrateAllocator(codec); rate_allocator_->SetLegacyConferenceMode( encoder_config_.legacy_conference_mode); diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc index 267b7d66b8..907d840093 100644 --- a/video/video_stream_encoder_unittest.cc +++ b/video/video_stream_encoder_unittest.cc @@ -1601,12 +1601,11 @@ class VideoStreamEncoderTest : public ::testing::Test { : bitrate_allocator_factory_( CreateBuiltinVideoBitrateAllocatorFactory()) {} - std::unique_ptr Create( - const Environment& env, + std::unique_ptr CreateVideoBitrateAllocator( const VideoCodec& codec) override { MutexLock lock(&mutex_); codec_config_ = codec; - return bitrate_allocator_factory_->Create(env, codec); + return bitrate_allocator_factory_->CreateVideoBitrateAllocator(codec); } VideoCodec codec_config() const {