mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Delete RTCWrappedNativeVideoDecoder
Instead implement creating native VideoDecoder via RTCNativeVideoDecoderBuilder protocol Bug: webrtc:15791 Change-Id: Iea66d09e01eae3b064a2943932d9a3cd33e8d19c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/340321 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41824}
This commit is contained in:
parent
f4aadf3774
commit
f7682f01bb
7 changed files with 55 additions and 95 deletions
|
@ -1543,8 +1543,6 @@ if (is_ios || is_mac) {
|
||||||
"objc/api/video_codec/RTCNativeVideoDecoder.h",
|
"objc/api/video_codec/RTCNativeVideoDecoder.h",
|
||||||
"objc/api/video_codec/RTCNativeVideoDecoder.mm",
|
"objc/api/video_codec/RTCNativeVideoDecoder.mm",
|
||||||
"objc/api/video_codec/RTCNativeVideoDecoderBuilder+Native.h",
|
"objc/api/video_codec/RTCNativeVideoDecoderBuilder+Native.h",
|
||||||
"objc/api/video_codec/RTCWrappedNativeVideoDecoder.h",
|
|
||||||
"objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm",
|
|
||||||
"objc/api/video_codec/RTCWrappedNativeVideoEncoder.h",
|
"objc/api/video_codec/RTCWrappedNativeVideoEncoder.h",
|
||||||
"objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm",
|
"objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm",
|
||||||
]
|
]
|
||||||
|
@ -1558,7 +1556,7 @@ if (is_ios || is_mac) {
|
||||||
"../api/environment",
|
"../api/environment",
|
||||||
"../api/video_codecs:video_codecs_api",
|
"../api/video_codecs:video_codecs_api",
|
||||||
"../media:codec",
|
"../media:codec",
|
||||||
"../media:rtc_media_base",
|
"../rtc_base:checks",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,10 @@
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "RTCWrappedNativeVideoDecoder.h"
|
#import "RTCNativeVideoDecoder.h"
|
||||||
#import "base/RTCMacros.h"
|
#import "base/RTCMacros.h"
|
||||||
#import "helpers/NSString+StdString.h"
|
#import "helpers/NSString+StdString.h"
|
||||||
|
#include "rtc_base/checks.h"
|
||||||
|
|
||||||
@implementation RTC_OBJC_TYPE (RTCNativeVideoDecoder)
|
@implementation RTC_OBJC_TYPE (RTCNativeVideoDecoder)
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,28 @@
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "RTCMacros.h"
|
#import "RTCMacros.h"
|
||||||
|
#import "RTCNativeVideoDecoder.h"
|
||||||
|
#import "RTCNativeVideoDecoderBuilder+Native.h"
|
||||||
#import "RTCVideoDecoderAV1.h"
|
#import "RTCVideoDecoderAV1.h"
|
||||||
#import "RTCWrappedNativeVideoDecoder.h"
|
|
||||||
|
|
||||||
#include "modules/video_coding/codecs/av1/dav1d_decoder.h"
|
#include "modules/video_coding/codecs/av1/dav1d_decoder.h"
|
||||||
|
|
||||||
|
@interface RTC_OBJC_TYPE (RTCVideoDecoderAV1Builder)
|
||||||
|
: RTC_OBJC_TYPE(RTCNativeVideoDecoder) <RTC_OBJC_TYPE (RTCNativeVideoDecoderBuilder)>
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation RTC_OBJC_TYPE (RTCVideoDecoderAV1Builder)
|
||||||
|
|
||||||
|
- (std::unique_ptr<webrtc::VideoDecoder>)build:(const webrtc::Environment&)env {
|
||||||
|
return webrtc::CreateDav1dDecoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation RTC_OBJC_TYPE (RTCVideoDecoderAV1)
|
@implementation RTC_OBJC_TYPE (RTCVideoDecoderAV1)
|
||||||
|
|
||||||
+ (id<RTC_OBJC_TYPE(RTCVideoDecoder)>)av1Decoder {
|
+ (id<RTC_OBJC_TYPE(RTCVideoDecoder)>)av1Decoder {
|
||||||
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) alloc]
|
return [[RTC_OBJC_TYPE(RTCVideoDecoderAV1Builder) alloc] init];
|
||||||
initWithNativeDecoder:std::unique_ptr<webrtc::VideoDecoder>(webrtc::CreateDav1dDecoder())];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -12,20 +12,32 @@
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "RTCMacros.h"
|
#import "RTCMacros.h"
|
||||||
|
#import "RTCNativeVideoDecoder.h"
|
||||||
|
#import "RTCNativeVideoDecoderBuilder+Native.h"
|
||||||
#import "RTCVideoDecoderVP9.h"
|
#import "RTCVideoDecoderVP9.h"
|
||||||
#import "RTCWrappedNativeVideoDecoder.h"
|
|
||||||
|
|
||||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||||
|
|
||||||
|
@interface RTC_OBJC_TYPE (RTCVideoDecoderVP9Builder)
|
||||||
|
: RTC_OBJC_TYPE(RTCNativeVideoDecoder) <RTC_OBJC_TYPE (RTCNativeVideoDecoderBuilder)>
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation RTC_OBJC_TYPE (RTCVideoDecoderVP9Builder)
|
||||||
|
|
||||||
|
- (std::unique_ptr<webrtc::VideoDecoder>)build:(const webrtc::Environment&)env {
|
||||||
|
return webrtc::VP9Decoder::Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation RTC_OBJC_TYPE (RTCVideoDecoderVP9)
|
@implementation RTC_OBJC_TYPE (RTCVideoDecoderVP9)
|
||||||
|
|
||||||
+ (id<RTC_OBJC_TYPE(RTCVideoDecoder)>)vp9Decoder {
|
+ (id<RTC_OBJC_TYPE(RTCVideoDecoder)>)vp9Decoder {
|
||||||
std::unique_ptr<webrtc::VideoDecoder> nativeDecoder(webrtc::VP9Decoder::Create());
|
#if defined(RTC_ENABLE_VP9)
|
||||||
if (nativeDecoder == nullptr) {
|
return [[RTC_OBJC_TYPE(RTCVideoDecoderVP9Builder) alloc] init];
|
||||||
|
#else
|
||||||
return nil;
|
return nil;
|
||||||
}
|
#endif
|
||||||
return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) alloc]
|
|
||||||
initWithNativeDecoder:std::move(nativeDecoder)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (bool)isSupported {
|
+ (bool)isSupported {
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017 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 "RTCNativeVideoDecoder.h"
|
|
||||||
#import "base/RTCMacros.h"
|
|
||||||
#import "base/RTCVideoDecoder.h"
|
|
||||||
|
|
||||||
#include "api/video_codecs/video_decoder.h"
|
|
||||||
#include "media/base/codec.h"
|
|
||||||
|
|
||||||
// TODO: bugs.webrtc.org/15791 - Remove in favor of the RTCNativeVideoDecoderBuilder
|
|
||||||
@interface RTC_OBJC_TYPE (RTCWrappedNativeVideoDecoder) : RTC_OBJC_TYPE (RTCNativeVideoDecoder)
|
|
||||||
|
|
||||||
- (instancetype)initWithNativeDecoder:(std::unique_ptr<webrtc::VideoDecoder>)decoder;
|
|
||||||
|
|
||||||
/* This moves the ownership of the wrapped decoder to the caller. */
|
|
||||||
- (std::unique_ptr<webrtc::VideoDecoder>)releaseWrappedDecoder;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017 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 "RTCWrappedNativeVideoDecoder.h"
|
|
||||||
#import "base/RTCMacros.h"
|
|
||||||
|
|
||||||
@implementation RTC_OBJC_TYPE (RTCWrappedNativeVideoDecoder) {
|
|
||||||
std::unique_ptr<webrtc::VideoDecoder> _wrappedDecoder;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithNativeDecoder:(std::unique_ptr<webrtc::VideoDecoder>)decoder {
|
|
||||||
if (self = [super init]) {
|
|
||||||
_wrappedDecoder = std::move(decoder);
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (std::unique_ptr<webrtc::VideoDecoder>)releaseWrappedDecoder {
|
|
||||||
return std::move(_wrappedDecoder);
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -19,7 +19,6 @@
|
||||||
#import "sdk/objc/api/peerconnection/RTCEncodedImage+Private.h"
|
#import "sdk/objc/api/peerconnection/RTCEncodedImage+Private.h"
|
||||||
#import "sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h"
|
#import "sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h"
|
||||||
#import "sdk/objc/api/video_codec/RTCNativeVideoDecoderBuilder+Native.h"
|
#import "sdk/objc/api/video_codec/RTCNativeVideoDecoderBuilder+Native.h"
|
||||||
#import "sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h"
|
|
||||||
#import "sdk/objc/helpers/NSString+StdString.h"
|
#import "sdk/objc/helpers/NSString+StdString.h"
|
||||||
|
|
||||||
#include "api/video_codecs/sdp_video_format.h"
|
#include "api/video_codecs/sdp_video_format.h"
|
||||||
|
@ -100,8 +99,6 @@ std::unique_ptr<VideoDecoder> ObjCVideoDecoderFactory::Create(const Environment
|
||||||
|
|
||||||
if ([decoder conformsToProtocol:@protocol(RTC_OBJC_TYPE(RTCNativeVideoDecoderBuilder))]) {
|
if ([decoder conformsToProtocol:@protocol(RTC_OBJC_TYPE(RTCNativeVideoDecoderBuilder))]) {
|
||||||
return [((id<RTC_OBJC_TYPE(RTCNativeVideoDecoderBuilder)>)decoder) build:env];
|
return [((id<RTC_OBJC_TYPE(RTCNativeVideoDecoderBuilder)>)decoder) build:env];
|
||||||
} else if ([decoder isKindOfClass:[RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) class]]) {
|
|
||||||
return [(RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) *)decoder releaseWrappedDecoder];
|
|
||||||
} else {
|
} else {
|
||||||
return std::unique_ptr<ObjCVideoDecoder>(new ObjCVideoDecoder(decoder));
|
return std::unique_ptr<ObjCVideoDecoder>(new ObjCVideoDecoder(decoder));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue