Replace BuiltinVideo{Encoder,Decoder}Factory with Video{Encoder,Decoder}FactoryTemplate.

Bug: webrtc:13573
Change-Id: I07e4fe9be938ba2540351b73ff22a090c68afa00
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/299663
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39777}
This commit is contained in:
philipel 2023-04-05 11:30:29 +02:00 committed by WebRTC LUCI CQ
parent a13b4d1d30
commit d2535a53cf
5 changed files with 28 additions and 12 deletions

View file

@ -898,9 +898,15 @@ if (current_os == "linux" || is_android) {
":libvpx_vp9_jni",
":native_api_jni",
":video_jni",
"../../api/video_codecs:builtin_video_decoder_factory",
"../../api/video_codecs:builtin_video_encoder_factory",
"../../api/video_codecs:video_codecs_api",
"../../api/video_codecs:video_decoder_factory_template",
"../../api/video_codecs:video_decoder_factory_template_dav1d_adapter",
"../../api/video_codecs:video_decoder_factory_template_libvpx_vp8_adapter",
"../../api/video_codecs:video_decoder_factory_template_libvpx_vp9_adapter",
"../../api/video_codecs:video_encoder_factory_template",
"../../api/video_codecs:video_encoder_factory_template_libaom_av1_adapter",
"../../api/video_codecs:video_encoder_factory_template_libvpx_vp8_adapter",
"../../api/video_codecs:video_encoder_factory_template_libvpx_vp9_adapter",
]
}

View file

@ -53,8 +53,8 @@ public class DefaultVideoEncoderFactoryTest {
VideoCodecInfo[] supportedCodecs = defFactory.getSupportedCodecs();
assertEquals(3, supportedCodecs.length);
assertEquals("VP8", supportedCodecs[0].name);
assertEquals("AV1", supportedCodecs[1].name);
assertEquals("VP9", supportedCodecs[2].name);
assertEquals("VP9", supportedCodecs[1].name);
assertEquals("AV1", supportedCodecs[2].name);
}
@SmallTest
@ -68,8 +68,8 @@ public class DefaultVideoEncoderFactoryTest {
VideoCodecInfo[] supportedCodecs = defFactory.getSupportedCodecs();
assertEquals(4, supportedCodecs.length);
assertEquals("VP8", supportedCodecs[0].name);
assertEquals("AV1", supportedCodecs[1].name);
assertEquals("VP9", supportedCodecs[2].name);
assertEquals("VP9", supportedCodecs[1].name);
assertEquals("AV1", supportedCodecs[2].name);
assertEquals("VP8", supportedCodecs[3].name);
assertEquals(1, supportedCodecs[3].params.size());
assertEquals("value", supportedCodecs[3].params.get("param"));

View file

@ -32,8 +32,8 @@ public class SoftwareVideoEncoderFactoryTest {
VideoCodecInfo[] codecs = factory.getSupportedCodecs();
assertThat(codecs.length).isEqualTo(3);
assertThat(codecs[0].name).isEqualTo("VP8");
assertThat(codecs[1].name).isEqualTo("AV1");
assertThat(codecs[2].name).isEqualTo("VP9");
assertThat(codecs[1].name).isEqualTo("VP9");
assertThat(codecs[2].name).isEqualTo("AV1");
}
@SmallTest

View file

@ -8,8 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/video_decoder.h"
#include "api/video_codecs/video_decoder_factory_template.h"
#include "api/video_codecs/video_decoder_factory_template_dav1d_adapter.h"
#include "api/video_codecs/video_decoder_factory_template_libvpx_vp8_adapter.h"
#include "api/video_codecs/video_decoder_factory_template_libvpx_vp9_adapter.h"
#include "sdk/android/generated_swcodecs_jni/SoftwareVideoDecoderFactory_jni.h"
#include "sdk/android/native_api/jni/java_types.h"
#include "sdk/android/src/jni/jni_helpers.h"
@ -20,7 +23,9 @@ namespace jni {
static jlong JNI_SoftwareVideoDecoderFactory_CreateFactory(JNIEnv* env) {
return webrtc::NativeToJavaPointer(
CreateBuiltinVideoDecoderFactory().release());
new VideoDecoderFactoryTemplate<LibvpxVp8DecoderTemplateAdapter,
LibvpxVp9DecoderTemplateAdapter,
Dav1dDecoderTemplateAdapter>());
}
static jlong JNI_SoftwareVideoDecoderFactory_CreateDecoder(

View file

@ -8,8 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/video_encoder_factory_template.h"
#include "api/video_codecs/video_encoder_factory_template_libaom_av1_adapter.h"
#include "api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h"
#include "api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter.h"
#include "sdk/android/generated_swcodecs_jni/SoftwareVideoEncoderFactory_jni.h"
#include "sdk/android/native_api/jni/java_types.h"
#include "sdk/android/src/jni/jni_helpers.h"
@ -20,7 +23,9 @@ namespace jni {
static jlong JNI_SoftwareVideoEncoderFactory_CreateFactory(JNIEnv* env) {
return webrtc::NativeToJavaPointer(
CreateBuiltinVideoEncoderFactory().release());
new VideoEncoderFactoryTemplate<LibvpxVp8EncoderTemplateAdapter,
LibvpxVp9EncoderTemplateAdapter,
LibaomAv1EncoderTemplateAdapter>());
}
static jlong JNI_SoftwareVideoEncoderFactory_CreateEncoder(