Deprecate VP8Decoder::Create

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 <sprang@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41792}
This commit is contained in:
Danil Chapovalov 2024-02-22 13:09:46 +01:00 committed by WebRTC LUCI CQ
parent bf20cf8a30
commit 4f63ea423f
6 changed files with 19 additions and 8 deletions

View File

@ -14,6 +14,7 @@
#include <memory>
#include <vector>
#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<SimulcastTestFixture> CreateSpecificSimulcastTestFixture(
});
std::unique_ptr<VideoDecoderFactory> decoder_factory =
std::make_unique<FunctionVideoDecoderFactory>(
[]() { 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));

View File

@ -41,11 +41,10 @@ class VP8Encoder {
static std::unique_ptr<VideoEncoder> 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<VideoDecoder> Create();
[[deprecated]] static std::unique_ptr<VideoDecoder> Create();
};
std::unique_ptr<VideoDecoder> CreateVp8Decoder(const Environment& env);

View File

@ -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",

View File

@ -12,6 +12,7 @@
#include <limits>
#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<VideoDecoder> 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();

View File

@ -11,6 +11,7 @@
#include <memory>
#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);

View File

@ -216,7 +216,7 @@ void MultiCodecReceiveTest::RunTestWithCodecs(
[](const Environment& env,
const SdpVideoFormat& format) -> std::unique_ptr<VideoDecoder> {
if (format.name == "VP8") {
return VP8Decoder::Create();
return CreateVp8Decoder(env);
}
if (format.name == "VP9") {
return VP9Decoder::Create();