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}
This commit is contained in:
philipel 2022-05-25 09:47:06 +02:00 committed by WebRTC LUCI CQ
parent 5ac19dfefc
commit 09a2848351
13 changed files with 19 additions and 155 deletions

View File

@ -94,29 +94,6 @@ rtc_library("libaom_av1_encoder") {
]
}
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

View File

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

View File

@ -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_

View File

@ -748,7 +748,7 @@ if (is_ios || is_mac) {
":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",
]
}

View File

@ -515,7 +515,7 @@ if (is_android) {
visibility = [ "*" ]
sources = [
"api/org/webrtc/LibaomAv1Decoder.java",
"api/org/webrtc/LibaomAv1EncoderIfSupported.java",
"api/org/webrtc/LibaomAv1Encoder.java",
]
deps = [
":base_java",
@ -885,16 +885,15 @@ if (current_os == "linux" || is_android) {
]
}
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 @@ if (current_os == "linux" || is_android) {
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 @@ if (current_os == "linux" || is_android) {
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"

View File

@ -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();
}

View File

@ -28,9 +28,8 @@ public class SoftwareVideoEncoderFactory implements VideoEncoderFactory {
&& 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 @@ public class SoftwareVideoEncoderFactory implements VideoEncoderFactory {
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()]);
}

View File

@ -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());
}

View File

@ -22,6 +22,4 @@ RTC_OBJC_EXPORT
*/
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)av1Encoder;
+ (bool)isSupported;
@end

View File

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

View File

@ -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];
}

View File

@ -937,7 +937,7 @@ if (rtc_include_tests) {
"../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",

View File

@ -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 @@ class VideoStreamEncoderWithRealEncoderTest
encoder = VP9Encoder::Create();
break;
case kVideoCodecAV1:
encoder = CreateLibaomAv1EncoderIfSupported();
encoder = CreateLibaomAv1Encoder();
break;
case kVideoCodecH264:
encoder =