diff --git a/modules/video_coding/codecs/test/videoprocessor.cc b/modules/video_coding/codecs/test/videoprocessor.cc index 09c0a75cc2..473be01556 100644 --- a/modules/video_coding/codecs/test/videoprocessor.cc +++ b/modules/video_coding/codecs/test/videoprocessor.cc @@ -196,12 +196,10 @@ VideoProcessor::VideoProcessor(webrtc::VideoEncoder* encoder, for (size_t i = 0; i < num_simulcast_or_spatial_layers_; ++i) { decode_callback_.push_back( std::make_unique(this, i)); - VideoDecoder::Settings decoder_settings; - decoder_settings.set_max_render_resolution( - {config_.codec_settings.width, config_.codec_settings.height}); - decoder_settings.set_codec_type(config_.codec_settings.codecType); - decoder_settings.set_number_of_cores(config_.NumberOfCores()); - RTC_CHECK(decoders_->at(i)->Configure(decoder_settings)); + RTC_CHECK_EQ( + decoders_->at(i)->InitDecode(&config_.codec_settings, + static_cast(config_.NumberOfCores())), + WEBRTC_VIDEO_CODEC_OK); RTC_CHECK_EQ(decoders_->at(i)->RegisterDecodeCompleteCallback( decode_callback_.at(i).get()), WEBRTC_VIDEO_CODEC_OK); diff --git a/modules/video_coding/codecs/test/videoprocessor_unittest.cc b/modules/video_coding/codecs/test/videoprocessor_unittest.cc index 6d78f7e305..2d9404293b 100644 --- a/modules/video_coding/codecs/test/videoprocessor_unittest.cc +++ b/modules/video_coding/codecs/test/videoprocessor_unittest.cc @@ -68,10 +68,10 @@ class VideoProcessorTest : public ::testing::Test { } void ExpectInit() { - EXPECT_CALL(encoder_mock_, InitEncode(_, _)); - EXPECT_CALL(encoder_mock_, RegisterEncodeCompleteCallback); - EXPECT_CALL(*decoder_mock_, Configure); - EXPECT_CALL(*decoder_mock_, RegisterDecodeCompleteCallback); + EXPECT_CALL(encoder_mock_, InitEncode(_, _)).Times(1); + EXPECT_CALL(encoder_mock_, RegisterEncodeCompleteCallback(_)).Times(1); + EXPECT_CALL(*decoder_mock_, InitDecode(_, _)).Times(1); + EXPECT_CALL(*decoder_mock_, RegisterDecodeCompleteCallback(_)).Times(1); } void ExpectRelease() { diff --git a/modules/video_coding/utility/simulcast_test_fixture_impl.cc b/modules/video_coding/utility/simulcast_test_fixture_impl.cc index 435f472475..d3951e5309 100644 --- a/modules/video_coding/utility/simulcast_test_fixture_impl.cc +++ b/modules/video_coding/utility/simulcast_test_fixture_impl.cc @@ -276,10 +276,7 @@ void SimulcastTestFixtureImpl::SetUpCodec(const int* temporal_layer_profile) { DefaultSettings(&settings_, temporal_layer_profile, codec_type_); SetUpRateAllocator(); EXPECT_EQ(0, encoder_->InitEncode(&settings_, kSettings)); - VideoDecoder::Settings decoder_settings; - decoder_settings.set_max_render_resolution({kDefaultWidth, kDefaultHeight}); - decoder_settings.set_codec_type(codec_type_); - EXPECT_TRUE(decoder_->Configure(decoder_settings)); + EXPECT_EQ(0, decoder_->InitDecode(&settings_, 1)); input_buffer_ = I420Buffer::Create(kDefaultWidth, kDefaultHeight); input_buffer_->InitializeData(); input_frame_ = std::make_unique( diff --git a/test/testsupport/ivf_video_frame_generator.cc b/test/testsupport/ivf_video_frame_generator.cc index f7eefdc2d2..e5c4c5fe55 100644 --- a/test/testsupport/ivf_video_frame_generator.cc +++ b/test/testsupport/ivf_video_frame_generator.cc @@ -38,17 +38,19 @@ IvfVideoFrameGenerator::IvfVideoFrameGenerator(const std::string& file_name) width_(file_reader_->GetFrameWidth()), height_(file_reader_->GetFrameHeight()) { RTC_CHECK(video_decoder_) << "No decoder found for file's video codec type"; - VideoDecoder::Settings decoder_settings; - decoder_settings.set_codec_type(file_reader_->GetVideoCodecType()); - decoder_settings.set_max_render_resolution( - {file_reader_->GetFrameWidth(), file_reader_->GetFrameHeight()}); + VideoCodec codec_settings; + codec_settings.codecType = file_reader_->GetVideoCodecType(); + codec_settings.width = file_reader_->GetFrameWidth(); + codec_settings.height = file_reader_->GetFrameHeight(); // Set buffer pool size to max value to ensure that if users of generator, // ex. test frameworks, will retain frames for quite a long time, decoder // won't crash with buffers pool overflow error. - decoder_settings.set_buffer_pool_size(std::numeric_limits::max()); + codec_settings.buffer_pool_size = std::numeric_limits::max(); RTC_CHECK_EQ(video_decoder_->RegisterDecodeCompleteCallback(&callback_), WEBRTC_VIDEO_CODEC_OK); - RTC_CHECK(video_decoder_->Configure(decoder_settings)); + RTC_CHECK_EQ( + video_decoder_->InitDecode(&codec_settings, /*number_of_cores=*/1), + WEBRTC_VIDEO_CODEC_OK); } IvfVideoFrameGenerator::~IvfVideoFrameGenerator() { MutexLock lock(&lock_); diff --git a/video/frame_dumping_decoder.cc b/video/frame_dumping_decoder.cc index 9592565893..59202dd03c 100644 --- a/video/frame_dumping_decoder.cc +++ b/video/frame_dumping_decoder.cc @@ -24,7 +24,8 @@ class FrameDumpingDecoder : public VideoDecoder { FrameDumpingDecoder(std::unique_ptr decoder, FileWrapper file); ~FrameDumpingDecoder() override; - bool Configure(const Settings& settings) override; + int32_t InitDecode(const VideoCodec* codec_settings, + int32_t number_of_cores) override; int32_t Decode(const EncodedImage& input_image, bool missing_frames, int64_t render_time_ms) override; @@ -48,9 +49,10 @@ FrameDumpingDecoder::FrameDumpingDecoder(std::unique_ptr decoder, FrameDumpingDecoder::~FrameDumpingDecoder() = default; -bool FrameDumpingDecoder::Configure(const Settings& settings) { - codec_type_ = settings.codec_type(); - return decoder_->Configure(settings); +int32_t FrameDumpingDecoder::InitDecode(const VideoCodec* codec_settings, + int32_t number_of_cores) { + codec_type_ = codec_settings->codecType; + return decoder_->InitDecode(codec_settings, number_of_cores); } int32_t FrameDumpingDecoder::Decode(const EncodedImage& input_image, diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc index e2e2bb8175..12e593573a 100644 --- a/video/video_receive_stream.cc +++ b/video/video_receive_stream.cc @@ -115,9 +115,10 @@ class WebRtcRecordableEncodedFrame : public RecordableEncodedFrame { // but logs messages to LS_ERROR. class NullVideoDecoder : public webrtc::VideoDecoder { public: - bool Configure(const Settings& settings) override { + int32_t InitDecode(const webrtc::VideoCodec* codec_settings, + int32_t number_of_cores) override { RTC_LOG(LS_ERROR) << "Can't initialize NullVideoDecoder."; - return true; + return WEBRTC_VIDEO_CODEC_OK; } int32_t Decode(const webrtc::EncodedImage& input_image, diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc index d7fcd086ac..a1b2f9f872 100644 --- a/video/video_receive_stream2.cc +++ b/video/video_receive_stream2.cc @@ -130,9 +130,10 @@ RenderResolution InitialDecoderResolution() { // but logs messages to LS_ERROR. class NullVideoDecoder : public webrtc::VideoDecoder { public: - bool Configure(const Settings& settings) override { + int32_t InitDecode(const webrtc::VideoCodec* codec_settings, + int32_t number_of_cores) override { RTC_LOG(LS_ERROR) << "Can't initialize NullVideoDecoder."; - return true; + return WEBRTC_VIDEO_CODEC_OK; } int32_t Decode(const webrtc::EncodedImage& input_image, diff --git a/video/video_stream_decoder_impl.cc b/video/video_stream_decoder_impl.cc index 3b65d17cca..4c52d35ff9 100644 --- a/video/video_stream_decoder_impl.cc +++ b/video/video_stream_decoder_impl.cc @@ -102,9 +102,9 @@ VideoDecoder* VideoStreamDecoderImpl::GetDecoder(int payload_type) { return nullptr; } - VideoDecoder::Settings settings; - settings.set_number_of_cores(decoder_settings_it->second.second); - if (!decoder->Configure(settings)) { + int num_cores = decoder_settings_it->second.second; + int32_t init_result = decoder->InitDecode(nullptr, num_cores); + if (init_result != WEBRTC_VIDEO_CODEC_OK) { RTC_LOG(LS_WARNING) << "Failed to initialize decoder for payload type " << payload_type << "."; return nullptr;