webrtc/sdk/objc/api/video_codec/RTCVideoEncoderAV1.mm
philipel 95701503f2 Make libaom_av1_encoder always build the libaom encoder.
Currently `CreateLibaomAv1Encoder` will either return an actual libaom AV1 encoder or a nullptr depening on whether the build flag `enable_libaom` was configured to true or not. This CL updates the `libaom_av1_encoder` build target to no longer depend on `enable_libaom` so that `CreateLibaomAv1Encoder` will always return an encoder instance.

Added `CreateLibaomAv1EncoderIfSupported` as a replacement to the old `CreateLibaomAv1Encoder`.

Bug: webrtc:13573
Change-Id: Ibdcd52c609acd79feefa2b86f19d1b4ca3e91d0a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/242360
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35763}
2022-01-21 13:45:47 +00:00

35 lines
1.1 KiB
Text

/*
* 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.
*
*/
#import <Foundation/Foundation.h>
#import "RTCMacros.h"
#import "RTCVideoEncoderAV1.h"
#import "RTCWrappedNativeVideoEncoder.h"
#include "modules/video_coding/codecs/av1/libaom_av1_encoder_supported.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;
}
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoEncoder) alloc]
initWithNativeEncoder:std::move(nativeEncoder)];
}
+ (bool)isSupported {
return webrtc::kIsLibaomAv1EncoderSupported;
}
@end