Always include the actual encoder implementation when RTCVideoEncoderAV1 is used.

Bug: webrtc:13573, b/236813931
Change-Id: I943ce51dac23bcbd6efe10413cfa9478f4ce6f55
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266485
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37352}
This commit is contained in:
Philip Eliasson
2022-06-22 14:24:59 +02:00
committed by WebRTC LUCI CQ
parent ce80886bf2
commit 91c05abd9b
3 changed files with 36 additions and 28 deletions

View File

@ -673,8 +673,8 @@ if (is_ios || is_mac) {
]
deps = [
":av1",
":base_objc",
":libaom_av1_decoder",
":native_video",
":videocodec_objc",
":videotoolbox_objc",
@ -682,6 +682,12 @@ if (is_ios || is_mac) {
":vp9",
":vpx_codec_constants",
]
defines = []
if (enable_libaom) {
defines += [ "RTC_USE_LIBAOM_AV1_ENCODER" ]
deps += [ ":libaom_av1_encoder" ]
}
}
rtc_library("vpx_codec_constants") {
@ -732,14 +738,12 @@ if (is_ios || is_mac) {
]
}
rtc_library("av1") {
rtc_library("libaom_av1_decoder") {
visibility = [ "*" ]
allow_poison = [ "software_video_codecs" ]
sources = [
"objc/api/video_codec/RTCVideoDecoderAV1.h",
"objc/api/video_codec/RTCVideoDecoderAV1.mm",
"objc/api/video_codec/RTCVideoEncoderAV1.h",
"objc/api/video_codec/RTCVideoEncoderAV1.mm",
]
deps = [
@ -748,12 +752,22 @@ if (is_ios || is_mac) {
"../media:rtc_media_base",
"../modules/video_coding/codecs/av1:libaom_av1_decoder",
]
}
defines = []
if (enable_libaom) {
defines += [ "RTC_USE_LIBAOM_AV1_ENCODER" ]
deps += [ "../modules/video_coding/codecs/av1:libaom_av1_encoder" ]
}
rtc_library("libaom_av1_encoder") {
visibility = [ "*" ]
allow_poison = [ "software_video_codecs" ]
sources = [
"objc/api/video_codec/RTCVideoEncoderAV1.h",
"objc/api/video_codec/RTCVideoEncoderAV1.mm",
]
deps = [
":base_objc",
":wrapped_native_codec_objc",
"../media:rtc_media_base",
"../modules/video_coding/codecs/av1:libaom_av1_encoder",
]
}
rtc_library("mediaconstraints_objc") {

View File

@ -14,29 +14,18 @@
#import "RTCMacros.h"
#import "RTCVideoEncoderAV1.h"
#import "RTCWrappedNativeVideoEncoder.h"
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h" // nogncheck
#endif
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h"
@implementation RTC_OBJC_TYPE (RTCVideoEncoderAV1)
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)av1Encoder {
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
std::unique_ptr<webrtc::VideoEncoder> nativeEncoder(webrtc::CreateLibaomAv1Encoder());
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoEncoder) alloc]
initWithNativeEncoder:std::move(nativeEncoder)];
#else
return nil;
#endif
}
+ (bool)isSupported {
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
return true;
#else
return false;
#endif
}
@end

View File

@ -13,11 +13,14 @@
#import "RTCH264ProfileLevelId.h"
#import "RTCVideoEncoderH264.h"
#import "api/video_codec/RTCVideoCodecConstants.h"
#import "api/video_codec/RTCVideoEncoderAV1.h"
#import "api/video_codec/RTCVideoEncoderVP8.h"
#import "api/video_codec/RTCVideoEncoderVP9.h"
#import "base/RTCVideoCodecInfo.h"
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
#import "api/video_codec/RTCVideoEncoderAV1.h" // nogncheck
#endif
@implementation RTC_OBJC_TYPE (RTCDefaultVideoEncoderFactory)
@synthesize preferredCodec;
@ -55,10 +58,9 @@
addObject:[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecVp9Name]];
}
if ([RTC_OBJC_TYPE(RTCVideoEncoderAV1) isSupported]) {
[result
addObject:[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecAv1Name]];
}
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
[result addObject:[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecAv1Name]];
#endif
return result;
}
@ -71,10 +73,13 @@
} 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]) {
}
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
if ([info.name isEqualToString:kRTCVideoCodecAv1Name]) {
return [RTC_OBJC_TYPE(RTCVideoEncoderAV1) av1Encoder];
}
#endif
return nil;
}