diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 206bd13b2b..6fa1bd241d 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -1543,8 +1543,6 @@ if (is_ios || is_mac) { "objc/api/video_codec/RTCNativeVideoDecoder.h", "objc/api/video_codec/RTCNativeVideoDecoder.mm", "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.mm", ] @@ -1558,7 +1556,7 @@ if (is_ios || is_mac) { "../api/environment", "../api/video_codecs:video_codecs_api", "../media:codec", - "../media:rtc_media_base", + "../rtc_base:checks", ] } diff --git a/sdk/objc/api/video_codec/RTCNativeVideoDecoder.mm b/sdk/objc/api/video_codec/RTCNativeVideoDecoder.mm index 8ade15b3c9..aaad9040be 100644 --- a/sdk/objc/api/video_codec/RTCNativeVideoDecoder.mm +++ b/sdk/objc/api/video_codec/RTCNativeVideoDecoder.mm @@ -10,9 +10,10 @@ #import -#import "RTCWrappedNativeVideoDecoder.h" +#import "RTCNativeVideoDecoder.h" #import "base/RTCMacros.h" #import "helpers/NSString+StdString.h" +#include "rtc_base/checks.h" @implementation RTC_OBJC_TYPE (RTCNativeVideoDecoder) diff --git a/sdk/objc/api/video_codec/RTCVideoDecoderAV1.mm b/sdk/objc/api/video_codec/RTCVideoDecoderAV1.mm index 81f5f93eec..92c5c67dc9 100644 --- a/sdk/objc/api/video_codec/RTCVideoDecoderAV1.mm +++ b/sdk/objc/api/video_codec/RTCVideoDecoderAV1.mm @@ -12,16 +12,28 @@ #import #import "RTCMacros.h" +#import "RTCNativeVideoDecoder.h" +#import "RTCNativeVideoDecoderBuilder+Native.h" #import "RTCVideoDecoderAV1.h" -#import "RTCWrappedNativeVideoDecoder.h" #include "modules/video_coding/codecs/av1/dav1d_decoder.h" -@implementation RTC_OBJC_TYPE (RTCVideoDecoderAV1) - -+ (id)av1Decoder { - return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) alloc] - initWithNativeDecoder:std::unique_ptr(webrtc::CreateDav1dDecoder())]; -} - +@interface RTC_OBJC_TYPE (RTCVideoDecoderAV1Builder) + : RTC_OBJC_TYPE(RTCNativeVideoDecoder) @end + + @implementation RTC_OBJC_TYPE (RTCVideoDecoderAV1Builder) + + - (std::unique_ptr)build:(const webrtc::Environment&)env { + return webrtc::CreateDav1dDecoder(); + } + + @end + + @implementation RTC_OBJC_TYPE (RTCVideoDecoderAV1) + + + (id)av1Decoder { + return [[RTC_OBJC_TYPE(RTCVideoDecoderAV1Builder) alloc] init]; + } + + @end diff --git a/sdk/objc/api/video_codec/RTCVideoDecoderVP9.mm b/sdk/objc/api/video_codec/RTCVideoDecoderVP9.mm index 05446d436d..e1f1d75590 100644 --- a/sdk/objc/api/video_codec/RTCVideoDecoderVP9.mm +++ b/sdk/objc/api/video_codec/RTCVideoDecoderVP9.mm @@ -12,28 +12,40 @@ #import #import "RTCMacros.h" +#import "RTCNativeVideoDecoder.h" +#import "RTCNativeVideoDecoderBuilder+Native.h" #import "RTCVideoDecoderVP9.h" -#import "RTCWrappedNativeVideoDecoder.h" #include "modules/video_coding/codecs/vp9/include/vp9.h" -@implementation RTC_OBJC_TYPE (RTCVideoDecoderVP9) - -+ (id)vp9Decoder { - std::unique_ptr nativeDecoder(webrtc::VP9Decoder::Create()); - if (nativeDecoder == nullptr) { - return nil; - } - return [[RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) alloc] - initWithNativeDecoder:std::move(nativeDecoder)]; -} - -+ (bool)isSupported { -#if defined(RTC_ENABLE_VP9) - return true; -#else - return false; -#endif -} - +@interface RTC_OBJC_TYPE (RTCVideoDecoderVP9Builder) + : RTC_OBJC_TYPE(RTCNativeVideoDecoder) @end + + @implementation RTC_OBJC_TYPE (RTCVideoDecoderVP9Builder) + + - (std::unique_ptr)build:(const webrtc::Environment&)env { + return webrtc::VP9Decoder::Create(); + } + + @end + + @implementation RTC_OBJC_TYPE (RTCVideoDecoderVP9) + + + (id)vp9Decoder { +#if defined(RTC_ENABLE_VP9) + return [[RTC_OBJC_TYPE(RTCVideoDecoderVP9Builder) alloc] init]; +#else + return nil; +#endif + } + + + (bool)isSupported { +#if defined(RTC_ENABLE_VP9) + return true; +#else + return false; +#endif + } + + @end diff --git a/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h b/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h deleted file mode 100644 index 93ffa2ff57..0000000000 --- a/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h +++ /dev/null @@ -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 - -#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)decoder; - -/* This moves the ownership of the wrapped decoder to the caller. */ -- (std::unique_ptr)releaseWrappedDecoder; - -@end diff --git a/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm b/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm deleted file mode 100644 index b812d9450d..0000000000 --- a/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm +++ /dev/null @@ -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 - -#import "RTCWrappedNativeVideoDecoder.h" -#import "base/RTCMacros.h" - -@implementation RTC_OBJC_TYPE (RTCWrappedNativeVideoDecoder) { - std::unique_ptr _wrappedDecoder; -} - -- (instancetype)initWithNativeDecoder:(std::unique_ptr)decoder { - if (self = [super init]) { - _wrappedDecoder = std::move(decoder); - } - - return self; -} - -- (std::unique_ptr)releaseWrappedDecoder { - return std::move(_wrappedDecoder); -} - -@end diff --git a/sdk/objc/native/src/objc_video_decoder_factory.mm b/sdk/objc/native/src/objc_video_decoder_factory.mm index 8939940deb..bc50892401 100644 --- a/sdk/objc/native/src/objc_video_decoder_factory.mm +++ b/sdk/objc/native/src/objc_video_decoder_factory.mm @@ -19,7 +19,6 @@ #import "sdk/objc/api/peerconnection/RTCEncodedImage+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/RTCWrappedNativeVideoDecoder.h" #import "sdk/objc/helpers/NSString+StdString.h" #include "api/video_codecs/sdp_video_format.h" @@ -100,8 +99,6 @@ std::unique_ptr ObjCVideoDecoderFactory::Create(const Environment if ([decoder conformsToProtocol:@protocol(RTC_OBJC_TYPE(RTCNativeVideoDecoderBuilder))]) { return [((id)decoder) build:env]; - } else if ([decoder isKindOfClass:[RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) class]]) { - return [(RTC_OBJC_TYPE(RTCWrappedNativeVideoDecoder) *)decoder releaseWrappedDecoder]; } else { return std::unique_ptr(new ObjCVideoDecoder(decoder)); }