Add AV1 encoder&decoder wrappers for iOS SDK.
It is now possible to use AV1 encoder and decoder on iOS and test them in apps like AppRTCMobile. Bug: None Change-Id: Ifae221020e5abf3809010676862eecd9ffeec5e3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208400 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33378}
This commit is contained in:
committed by
Commit Bot
parent
662d4c328f
commit
8cfb287735
@ -12,5 +12,6 @@
|
||||
|
||||
#import "RTCMacros.h"
|
||||
|
||||
RTC_OBJC_EXPORT extern NSString* const kRTCVideoCodecVp8Name;
|
||||
RTC_OBJC_EXPORT extern NSString* const kRTCVideoCodecVp9Name;
|
||||
RTC_EXTERN NSString* const kRTCVideoCodecVp8Name;
|
||||
RTC_EXTERN NSString* const kRTCVideoCodecVp9Name;
|
||||
RTC_EXTERN NSString* const kRTCVideoCodecAv1Name;
|
||||
|
||||
@ -15,3 +15,4 @@
|
||||
|
||||
NSString *const kRTCVideoCodecVp8Name = @(cricket::kVp8CodecName);
|
||||
NSString *const kRTCVideoCodecVp9Name = @(cricket::kVp9CodecName);
|
||||
NSString *const kRTCVideoCodecAv1Name = @(cricket::kAv1CodecName);
|
||||
|
||||
27
sdk/objc/api/video_codec/RTCVideoDecoderAV1.h
Normal file
27
sdk/objc/api/video_codec/RTCVideoDecoderAV1.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 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 "RTCVideoDecoder.h"
|
||||
|
||||
RTC_OBJC_EXPORT
|
||||
@interface RTC_OBJC_TYPE (RTCVideoDecoderAV1) : NSObject
|
||||
|
||||
/* This returns a AV1 decoder that can be returned from a RTCVideoDecoderFactory injected into
|
||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be
|
||||
* used independently from the RTCPeerConnectionFactory.
|
||||
*/
|
||||
+ (id<RTC_OBJC_TYPE(RTCVideoDecoder)>)av1Decoder;
|
||||
|
||||
+ (bool)isSupported;
|
||||
|
||||
@end
|
||||
35
sdk/objc/api/video_codec/RTCVideoDecoderAV1.mm
Normal file
35
sdk/objc/api/video_codec/RTCVideoDecoderAV1.mm
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 "RTCVideoDecoderAV1.h"
|
||||
#import "RTCWrappedNativeVideoDecoder.h"
|
||||
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_decoder.h"
|
||||
|
||||
@implementation RTC_OBJC_TYPE (RTCVideoDecoderAV1)
|
||||
|
||||
+ (id<RTC_OBJC_TYPE(RTCVideoDecoder)>)av1Decoder {
|
||||
std::unique_ptr<webrtc::VideoDecoder> nativeDecoder(webrtc::CreateLibaomAv1Decoder());
|
||||
if (nativeDecoder == nullptr) {
|
||||
return nil;
|
||||
}
|
||||
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) alloc]
|
||||
initWithNativeDecoder:std::move(nativeDecoder)];
|
||||
}
|
||||
|
||||
+ (bool)isSupported {
|
||||
return webrtc::kIsLibaomAv1DecoderSupported;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -22,4 +22,6 @@ RTC_OBJC_EXPORT
|
||||
*/
|
||||
+ (id<RTC_OBJC_TYPE(RTCVideoDecoder)>)vp9Decoder;
|
||||
|
||||
+ (bool)isSupported;
|
||||
|
||||
@end
|
||||
|
||||
@ -20,8 +20,20 @@
|
||||
@implementation RTC_OBJC_TYPE (RTCVideoDecoderVP9)
|
||||
|
||||
+ (id<RTC_OBJC_TYPE(RTCVideoDecoder)>)vp9Decoder {
|
||||
std::unique_ptr<webrtc::VideoDecoder> nativeDecoder(webrtc::VP9Decoder::Create());
|
||||
if (nativeDecoder == nullptr) {
|
||||
return nil;
|
||||
}
|
||||
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) alloc]
|
||||
initWithNativeDecoder:std::unique_ptr<webrtc::VideoDecoder>(webrtc::VP9Decoder::Create())];
|
||||
initWithNativeDecoder:std::move(nativeDecoder)];
|
||||
}
|
||||
|
||||
+ (bool)isSupported {
|
||||
#if defined(RTC_ENABLE_VP9)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
27
sdk/objc/api/video_codec/RTCVideoEncoderAV1.h
Normal file
27
sdk/objc/api/video_codec/RTCVideoEncoderAV1.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 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 "RTCVideoEncoder.h"
|
||||
|
||||
RTC_OBJC_EXPORT
|
||||
@interface RTC_OBJC_TYPE (RTCVideoEncoderAV1) : NSObject
|
||||
|
||||
/* This returns a AV1 encoder that can be returned from a RTCVideoEncoderFactory injected into
|
||||
* RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
|
||||
* used independently from the RTCPeerConnectionFactory.
|
||||
*/
|
||||
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)av1Encoder;
|
||||
|
||||
+ (bool)isSupported;
|
||||
|
||||
@end
|
||||
35
sdk/objc/api/video_codec/RTCVideoEncoderAV1.mm
Normal file
35
sdk/objc/api/video_codec/RTCVideoEncoderAV1.mm
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.h"
|
||||
|
||||
@implementation RTC_OBJC_TYPE (RTCVideoEncoderAV1)
|
||||
|
||||
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)av1Encoder {
|
||||
std::unique_ptr<webrtc::VideoEncoder> nativeEncoder(webrtc::CreateLibaomAv1Encoder());
|
||||
if (nativeEncoder == nullptr) {
|
||||
return nil;
|
||||
}
|
||||
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoEncoder) alloc]
|
||||
initWithNativeEncoder:std::move(nativeEncoder)];
|
||||
}
|
||||
|
||||
+ (bool)isSupported {
|
||||
return webrtc::kIsLibaomAv1EncoderSupported;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -22,4 +22,6 @@ RTC_OBJC_EXPORT
|
||||
*/
|
||||
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)vp9Encoder;
|
||||
|
||||
+ (bool)isSupported;
|
||||
|
||||
@end
|
||||
|
||||
@ -20,8 +20,20 @@
|
||||
@implementation RTC_OBJC_TYPE (RTCVideoEncoderVP9)
|
||||
|
||||
+ (id<RTC_OBJC_TYPE(RTCVideoEncoder)>)vp9Encoder {
|
||||
std::unique_ptr<webrtc::VideoEncoder> nativeEncoder(webrtc::VP9Encoder::Create());
|
||||
if (nativeEncoder == nullptr) {
|
||||
return nil;
|
||||
}
|
||||
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoEncoder) alloc]
|
||||
initWithNativeEncoder:std::unique_ptr<webrtc::VideoEncoder>(webrtc::VP9Encoder::Create())];
|
||||
initWithNativeEncoder:std::move(nativeEncoder)];
|
||||
}
|
||||
|
||||
+ (bool)isSupported {
|
||||
#if defined(RTC_ENABLE_VP9)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user