Remove LibaomAv1EncoderIfSupported
Bug: webrtc:13573
Change-Id: Ia9a6d1809488d92753527350a61f0a46159ccd8b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262814
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Xavier Lepaul‎ <xalep@webrtc.org>
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37033}
diff --git a/modules/video_coding/codecs/av1/BUILD.gn b/modules/video_coding/codecs/av1/BUILD.gn
index 73b22d4..7f8e731 100644
--- a/modules/video_coding/codecs/av1/BUILD.gn
+++ b/modules/video_coding/codecs/av1/BUILD.gn
@@ -94,29 +94,6 @@
]
}
-rtc_library("libaom_av1_encoder_if_supported") {
- visibility = [ "*" ]
- poisonous = [ "software_video_codecs" ]
- public = [ "libaom_av1_encoder_supported.h" ]
- sources = [ "libaom_av1_encoder_supported.cc" ]
- deps = [
- "../../../../api/video_codecs:video_codecs_api",
- "../../svc:scalability_mode_util",
- "../../svc:scalability_structures",
- "../../svc:scalable_video_controller",
- ]
- absl_deps = [
- "//third_party/abseil-cpp/absl/base:core_headers",
- "//third_party/abseil-cpp/absl/strings:strings",
- ]
-
- defines = []
- if (enable_libaom) {
- defines += [ "RTC_USE_LIBAOM_AV1_ENCODER" ]
- deps += [ ":libaom_av1_encoder" ]
- }
-}
-
if (rtc_include_tests) {
rtc_library("video_coding_codecs_av1_tests") {
testonly = true
diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder_supported.cc b/modules/video_coding/codecs/av1/libaom_av1_encoder_supported.cc
deleted file mode 100644
index 97895e2..0000000
--- a/modules/video_coding/codecs/av1/libaom_av1_encoder_supported.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#include "modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h"
-
-#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
-#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h" // nogncheck
-#endif
-
-namespace webrtc {
-#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
-ABSL_CONST_INIT const bool kIsLibaomAv1EncoderSupported = true;
-std::unique_ptr<VideoEncoder> CreateLibaomAv1EncoderIfSupported() {
- return CreateLibaomAv1Encoder();
-}
-#else
-ABSL_CONST_INIT const bool kIsLibaomAv1EncoderSupported = false;
-std::unique_ptr<VideoEncoder> CreateLibaomAv1EncoderIfSupported() {
- return nullptr;
-}
-#endif
-
-} // namespace webrtc
diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h b/modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h
deleted file mode 100644
index d27ac89..0000000
--- a/modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef MODULES_VIDEO_CODING_CODECS_AV1_LIBAOM_AV1_ENCODER_SUPPORTED_H_
-#define MODULES_VIDEO_CODING_CODECS_AV1_LIBAOM_AV1_ENCODER_SUPPORTED_H_
-
-#include <memory>
-
-#include "absl/base/attributes.h"
-#include "absl/strings/string_view.h"
-#include "api/video_codecs/video_encoder.h"
-
-namespace webrtc {
-
-ABSL_CONST_INIT extern const bool kIsLibaomAv1EncoderSupported;
-
-std::unique_ptr<VideoEncoder> CreateLibaomAv1EncoderIfSupported();
-
-} // namespace webrtc
-
-#endif // MODULES_VIDEO_CODING_CODECS_AV1_LIBAOM_AV1_ENCODER_SUPPORTED_H_
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index be70c53..2e34175 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -748,7 +748,7 @@
":wrapped_native_codec_objc",
"../media:rtc_media_base",
"../modules/video_coding/codecs/av1:libaom_av1_decoder",
- "../modules/video_coding/codecs/av1:libaom_av1_encoder_if_supported",
+ "../modules/video_coding/codecs/av1:libaom_av1_encoder",
]
}
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index edb156c..2df33ab 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -515,7 +515,7 @@
visibility = [ "*" ]
sources = [
"api/org/webrtc/LibaomAv1Decoder.java",
- "api/org/webrtc/LibaomAv1EncoderIfSupported.java",
+ "api/org/webrtc/LibaomAv1Encoder.java",
]
deps = [
":base_java",
@@ -885,16 +885,15 @@
]
}
- rtc_library("libaom_av1_jni_if_supported") {
+ rtc_library("libaom_av1_decoder_if_supported_jni") {
visibility = [ "*" ]
allow_poison = [ "software_video_codecs" ]
sources = [ "src/jni/libaom_av1_codec.cc" ]
deps = [
":base_jni",
- ":generated_libaom_av1_jni_if_supported",
+ ":generated_libaom_av1_decoder_if_supported_jni",
":video_jni",
"../../modules/video_coding/codecs/av1:libaom_av1_decoder",
- "../../modules/video_coding/codecs/av1:libaom_av1_encoder_if_supported",
]
}
@@ -914,7 +913,7 @@
visibility = [ "*" ]
allow_poison = [ "software_video_codecs" ]
deps = [
- ":libaom_av1_jni_if_supported",
+ ":libaom_av1_decoder_if_supported_jni",
":libvpx_vp8_jni",
":libvpx_vp9_jni",
]
@@ -1371,11 +1370,8 @@
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}
- generate_jni("generated_libaom_av1_jni_if_supported") {
- sources = [
- "api/org/webrtc/LibaomAv1Decoder.java",
- "api/org/webrtc/LibaomAv1EncoderIfSupported.java",
- ]
+ generate_jni("generated_libaom_av1_decoder_if_supported_jni") {
+ sources = [ "api/org/webrtc/LibaomAv1Decoder.java" ]
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
diff --git a/sdk/android/api/org/webrtc/LibaomAv1EncoderIfSupported.java b/sdk/android/api/org/webrtc/LibaomAv1EncoderIfSupported.java
deleted file mode 100644
index 2d5cff7..0000000
--- a/sdk/android/api/org/webrtc/LibaomAv1EncoderIfSupported.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-package org.webrtc;
-
-public class LibaomAv1EncoderIfSupported extends WrappedNativeVideoEncoder {
- @Override
- public long createNativeVideoEncoder() {
- return nativeCreateEncoder();
- }
-
- static native long nativeCreateEncoder();
-
- @Override
- public boolean isHardwareEncoder() {
- return false;
- }
-
- static native boolean nativeIsSupported();
-}
diff --git a/sdk/android/api/org/webrtc/SoftwareVideoEncoderFactory.java b/sdk/android/api/org/webrtc/SoftwareVideoEncoderFactory.java
index 1c0b216..c4ac229 100644
--- a/sdk/android/api/org/webrtc/SoftwareVideoEncoderFactory.java
+++ b/sdk/android/api/org/webrtc/SoftwareVideoEncoderFactory.java
@@ -28,9 +28,8 @@
&& LibvpxVp9Encoder.nativeIsSupported()) {
return new LibvpxVp9Encoder();
}
- if (codecName.equalsIgnoreCase(VideoCodecMimeType.AV1.name())
- && LibaomAv1EncoderIfSupported.nativeIsSupported()) {
- return new LibaomAv1EncoderIfSupported();
+ if (codecName.equalsIgnoreCase(VideoCodecMimeType.AV1.name())) {
+ return new LibaomAv1Encoder();
}
return null;
@@ -48,9 +47,7 @@
if (LibvpxVp9Encoder.nativeIsSupported()) {
codecs.add(new VideoCodecInfo(VideoCodecMimeType.VP9.name(), new HashMap<>()));
}
- if (LibaomAv1EncoderIfSupported.nativeIsSupported()) {
- codecs.add(new VideoCodecInfo(VideoCodecMimeType.AV1.name(), new HashMap<>()));
- }
+ codecs.add(new VideoCodecInfo(VideoCodecMimeType.AV1.name(), new HashMap<>()));
return codecs.toArray(new VideoCodecInfo[codecs.size()]);
}
diff --git a/sdk/android/src/jni/libaom_av1_codec.cc b/sdk/android/src/jni/libaom_av1_codec.cc
index 220443a..143055f 100644
--- a/sdk/android/src/jni/libaom_av1_codec.cc
+++ b/sdk/android/src/jni/libaom_av1_codec.cc
@@ -11,23 +11,12 @@
#include <jni.h>
#include "modules/video_coding/codecs/av1/libaom_av1_decoder.h"
-#include "modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h"
-#include "sdk/android/generated_libaom_av1_jni_if_supported/LibaomAv1Decoder_jni.h"
-#include "sdk/android/generated_libaom_av1_jni_if_supported/LibaomAv1EncoderIfSupported_jni.h"
+#include "sdk/android/generated_libaom_av1_decoder_if_supported_jni/LibaomAv1Decoder_jni.h"
#include "sdk/android/src/jni/jni_helpers.h"
namespace webrtc {
namespace jni {
-static jlong JNI_LibaomAv1EncoderIfSupported_CreateEncoder(JNIEnv* jni) {
- return jlongFromPointer(
- webrtc::CreateLibaomAv1EncoderIfSupported().release());
-}
-
-static jboolean JNI_LibaomAv1EncoderIfSupported_IsSupported(JNIEnv* jni) {
- return webrtc::kIsLibaomAv1EncoderSupported;
-}
-
static jlong JNI_LibaomAv1Decoder_CreateDecoder(JNIEnv* jni) {
return jlongFromPointer(webrtc::CreateLibaomAv1Decoder().release());
}
diff --git a/sdk/objc/api/video_codec/RTCVideoEncoderAV1.h b/sdk/objc/api/video_codec/RTCVideoEncoderAV1.h
index 8aa55e4..b0d6af1 100644
--- a/sdk/objc/api/video_codec/RTCVideoEncoderAV1.h
+++ b/sdk/objc/api/video_codec/RTCVideoEncoderAV1.h
@@ -22,6 +22,4 @@
*/
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)av1Encoder;
-+ (bool)isSupported;
-
@end
diff --git a/sdk/objc/api/video_codec/RTCVideoEncoderAV1.mm b/sdk/objc/api/video_codec/RTCVideoEncoderAV1.mm
index 853ffed..e6ce7ea 100644
--- a/sdk/objc/api/video_codec/RTCVideoEncoderAV1.mm
+++ b/sdk/objc/api/video_codec/RTCVideoEncoderAV1.mm
@@ -15,21 +15,15 @@
#import "RTCVideoEncoderAV1.h"
#import "RTCWrappedNativeVideoEncoder.h"
-#include "modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h"
+#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h"
@implementation RTC_OBJC_TYPE (RTCVideoEncoderAV1)
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)av1Encoder {
- std::unique_ptr<webrtc::VideoEncoder> nativeEncoder(webrtc::CreateLibaomAv1EncoderIfSupported());
- if (nativeEncoder == nullptr) {
- return nil;
- }
+ std::unique_ptr<webrtc::VideoEncoder> nativeEncoder(webrtc::CreateLibaomAv1Encoder());
+
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoEncoder) alloc]
initWithNativeEncoder:std::move(nativeEncoder)];
}
-+ (bool)isSupported {
- return webrtc::kIsLibaomAv1EncoderSupported;
-}
-
@end
diff --git a/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m b/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m
index 06c4e8c..98481d0 100644
--- a/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m
+++ b/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m
@@ -55,10 +55,7 @@
addObject:[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecVp9Name]];
}
- if ([RTC_OBJC_TYPE(RTCVideoEncoderAV1) isSupported]) {
- [result
- addObject:[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecAv1Name]];
- }
+ [result addObject:[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecAv1Name]];
return result;
}
@@ -71,8 +68,7 @@
} else if ([info.name isEqualToString:kRTCVideoCodecVp9Name] &&
[RTC_OBJC_TYPE(RTCVideoEncoderVP9) isSupported]) {
return [RTC_OBJC_TYPE(RTCVideoEncoderVP9) vp9Encoder];
- } else if ([info.name isEqualToString:kRTCVideoCodecAv1Name] &&
- [RTC_OBJC_TYPE(RTCVideoEncoderAV1) isSupported]) {
+ } else if ([info.name isEqualToString:kRTCVideoCodecAv1Name]) {
return [RTC_OBJC_TYPE(RTCVideoEncoderAV1) av1Encoder];
}
diff --git a/video/BUILD.gn b/video/BUILD.gn
index 178ac77..bd33167 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -937,7 +937,7 @@
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp9",
"../modules/video_coding:webrtc_vp9_helpers",
- "../modules/video_coding/codecs/av1:libaom_av1_encoder_if_supported",
+ "../modules/video_coding/codecs/av1:libaom_av1_encoder",
"../modules/video_coding/svc:scalability_mode_util",
"../modules/video_coding/svc:scalability_structures",
"../modules/video_coding/svc:scalable_video_controller",
diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc
index 9c54c88..fe49089 100644
--- a/video/video_stream_encoder_unittest.cc
+++ b/video/video_stream_encoder_unittest.cc
@@ -41,7 +41,7 @@
#include "common_video/include/video_frame_buffer.h"
#include "media/base/video_adapter.h"
#include "media/engine/webrtc_video_engine.h"
-#include "modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h"
+#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h"
#include "modules/video_coding/codecs/h264/include/h264.h"
#include "modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h"
#include "modules/video_coding/codecs/vp8/include/vp8.h"
@@ -8625,7 +8625,7 @@
encoder = VP9Encoder::Create();
break;
case kVideoCodecAV1:
- encoder = CreateLibaomAv1EncoderIfSupported();
+ encoder = CreateLibaomAv1Encoder();
break;
case kVideoCodecH264:
encoder =