From 4f63ea423f6fee0386ef2e0fc17b192e736b69cb Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Thu, 22 Feb 2024 13:09:46 +0100 Subject: [PATCH] Deprecate VP8Decoder::Create MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrate remaining usages inside webrtc (all are test only) to CreateVp8Decoder Bug: webrtc:15791 Change-Id: I6a8317a8761953208ba746ac785fa1606217e6f5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/340300 Commit-Queue: Erik Språng Reviewed-by: Erik Språng Auto-Submit: Danil Chapovalov Cr-Commit-Position: refs/heads/main@{#41792} --- media/engine/simulcast_encoder_adapter_unittest.cc | 5 ++++- modules/video_coding/codecs/vp8/include/vp8.h | 5 ++--- test/BUILD.gn | 1 + test/testsupport/ivf_video_frame_generator.cc | 5 ++++- video/end_to_end_tests/codec_tests.cc | 9 +++++++-- video/end_to_end_tests/multi_codec_receive_tests.cc | 2 +- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/media/engine/simulcast_encoder_adapter_unittest.cc b/media/engine/simulcast_encoder_adapter_unittest.cc index 3ee3465e13..4abda03e51 100644 --- a/media/engine/simulcast_encoder_adapter_unittest.cc +++ b/media/engine/simulcast_encoder_adapter_unittest.cc @@ -14,6 +14,7 @@ #include #include +#include "api/environment/environment.h" #include "api/field_trials_view.h" #include "api/test/create_simulcast_test_fixture.h" #include "api/test/simulcast_test_fixture.h" @@ -62,7 +63,9 @@ std::unique_ptr CreateSpecificSimulcastTestFixture( }); std::unique_ptr decoder_factory = std::make_unique( - []() { return VP8Decoder::Create(); }); + [](const Environment& env, const SdpVideoFormat& format) { + return CreateVp8Decoder(env); + }); return CreateSimulcastTestFixture(std::move(encoder_factory), std::move(decoder_factory), SdpVideoFormat(cricket::kVp8CodecName)); diff --git a/modules/video_coding/codecs/vp8/include/vp8.h b/modules/video_coding/codecs/vp8/include/vp8.h index 45b7cee00a..b03200ade5 100644 --- a/modules/video_coding/codecs/vp8/include/vp8.h +++ b/modules/video_coding/codecs/vp8/include/vp8.h @@ -41,11 +41,10 @@ class VP8Encoder { static std::unique_ptr Create(Settings settings); }; -// TODO: bugs.webrtc.org/15791 - Deprecate and delete in favor of the -// CreateVp8Decoder function. +// TODO: bugs.webrtc.org/15791 - Delete in favor of the CreateVp8Decoder below. class VP8Decoder { public: - static std::unique_ptr Create(); + [[deprecated]] static std::unique_ptr Create(); }; std::unique_ptr CreateVp8Decoder(const Environment& env); diff --git a/test/BUILD.gn b/test/BUILD.gn index ed5dc5173d..d9f2b92f84 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -53,6 +53,7 @@ rtc_library("frame_generator_impl") { "../api:frame_generator_api", "../api:scoped_refptr", "../api:sequence_checker", + "../api/environment:environment_factory", "../api/video:encoded_image", "../api/video:video_frame", "../api/video:video_frame_i010", diff --git a/test/testsupport/ivf_video_frame_generator.cc b/test/testsupport/ivf_video_frame_generator.cc index 0dec1135f0..d2ce215e8b 100644 --- a/test/testsupport/ivf_video_frame_generator.cc +++ b/test/testsupport/ivf_video_frame_generator.cc @@ -12,6 +12,7 @@ #include +#include "api/environment/environment_factory.h" #include "api/video/encoded_image.h" #include "api/video/i420_buffer.h" #include "api/video_codecs/video_codec.h" @@ -137,7 +138,9 @@ void IvfVideoFrameGenerator::OnFrameDecoded(const VideoFrame& decoded_frame) { std::unique_ptr IvfVideoFrameGenerator::CreateVideoDecoder( VideoCodecType codec_type) { if (codec_type == VideoCodecType::kVideoCodecVP8) { - return VP8Decoder::Create(); + // Use a default environment for the VP8 decoder while there is no use case + // for a propagated environment in this test utility IvfVideoFrameGenerator. + return CreateVp8Decoder(CreateEnvironment()); } if (codec_type == VideoCodecType::kVideoCodecVP9) { return VP9Decoder::Create(); diff --git a/video/end_to_end_tests/codec_tests.cc b/video/end_to_end_tests/codec_tests.cc index e9ec7d541f..f9f3a41cd4 100644 --- a/video/end_to_end_tests/codec_tests.cc +++ b/video/end_to_end_tests/codec_tests.cc @@ -11,6 +11,7 @@ #include #include "absl/types/optional.h" +#include "api/environment/environment.h" #include "api/test/video/function_video_encoder_factory.h" #include "api/video/color_space.h" #include "api/video/video_rotation.h" @@ -126,7 +127,9 @@ TEST_F(CodecEndToEndTest, SendsAndReceivesVP8) { test::FunctionVideoEncoderFactory encoder_factory( []() { return VP8Encoder::Create(); }); test::FunctionVideoDecoderFactory decoder_factory( - []() { return VP8Decoder::Create(); }); + [](const Environment& env, const SdpVideoFormat& format) { + return CreateVp8Decoder(env); + }); CodecObserver test(5, kVideoRotation_0, absl::nullopt, "VP8", &encoder_factory, &decoder_factory); RunBaseTest(&test); @@ -136,7 +139,9 @@ TEST_F(CodecEndToEndTest, SendsAndReceivesVP8Rotation90) { test::FunctionVideoEncoderFactory encoder_factory( []() { return VP8Encoder::Create(); }); test::FunctionVideoDecoderFactory decoder_factory( - []() { return VP8Decoder::Create(); }); + [](const Environment& env, const SdpVideoFormat& format) { + return CreateVp8Decoder(env); + }); CodecObserver test(5, kVideoRotation_90, absl::nullopt, "VP8", &encoder_factory, &decoder_factory); RunBaseTest(&test); diff --git a/video/end_to_end_tests/multi_codec_receive_tests.cc b/video/end_to_end_tests/multi_codec_receive_tests.cc index e236af007b..56fce60915 100644 --- a/video/end_to_end_tests/multi_codec_receive_tests.cc +++ b/video/end_to_end_tests/multi_codec_receive_tests.cc @@ -216,7 +216,7 @@ void MultiCodecReceiveTest::RunTestWithCodecs( [](const Environment& env, const SdpVideoFormat& format) -> std::unique_ptr { if (format.name == "VP8") { - return VP8Decoder::Create(); + return CreateVp8Decoder(env); } if (format.name == "VP9") { return VP9Decoder::Create();