Wrap WebRTC OBJC API types with RTC_OBJC_TYPE. This CL introduced 2 new macros that affect the WebRTC OBJC API symbols: - RTC_OBJC_TYPE_PREFIX: Macro used to prepend a prefix to the API types that are exported with RTC_OBJC_EXPORT. Clients can patch the definition of this macro locally and build WebRTC.framework with their own prefix in case symbol clashing is a problem. This macro must only be defined by changing the value in sdk/objc/base/RTCMacros.h and not on via compiler flag to ensure it has a unique value. - RCT_OBJC_TYPE: Macro used internally to reference API types. Declaring an API type without using this macro will not include the declared type in the set of types that will be affected by the configurable RTC_OBJC_TYPE_PREFIX. Manual changes: https://webrtc-review.googlesource.com/c/src/+/173781/5..10 The auto-generated changes in PS#5 have been done with: https://webrtc-review.googlesource.com/c/src/+/174061. Bug: None Change-Id: I0d54ca94db764fb3b6cb4365873f79e14cd879b8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173781 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31153}
diff --git a/sdk/objc/base/RTCCodecSpecificInfo.h b/sdk/objc/base/RTCCodecSpecificInfo.h index e2ae4ca..5e7800e 100644 --- a/sdk/objc/base/RTCCodecSpecificInfo.h +++ b/sdk/objc/base/RTCCodecSpecificInfo.h
@@ -18,7 +18,7 @@ * Corresponds to webrtc::CodecSpecificInfo. */ RTC_OBJC_EXPORT -@protocol RTCCodecSpecificInfo <NSObject> -@end +@protocol RTC_OBJC_TYPE +(RTCCodecSpecificInfo)<NSObject> @end NS_ASSUME_NONNULL_END
diff --git a/sdk/objc/base/RTCEncodedImage.h b/sdk/objc/base/RTCEncodedImage.h index 670c727..5fec8a2 100644 --- a/sdk/objc/base/RTCEncodedImage.h +++ b/sdk/objc/base/RTCEncodedImage.h
@@ -31,7 +31,7 @@ /** Represents an encoded frame. Corresponds to webrtc::EncodedImage. */ RTC_OBJC_EXPORT -@interface RTCEncodedImage : NSObject +@interface RTC_OBJC_TYPE (RTCEncodedImage) : NSObject @property(nonatomic, strong) NSData *buffer; @property(nonatomic, assign) int32_t encodedWidth;
diff --git a/sdk/objc/base/RTCEncodedImage.m b/sdk/objc/base/RTCEncodedImage.m index 024a57c..dec9630 100644 --- a/sdk/objc/base/RTCEncodedImage.m +++ b/sdk/objc/base/RTCEncodedImage.m
@@ -10,7 +10,7 @@ #import "RTCEncodedImage.h" -@implementation RTCEncodedImage +@implementation RTC_OBJC_TYPE (RTCEncodedImage) @synthesize buffer = _buffer; @synthesize encodedWidth = _encodedWidth;
diff --git a/sdk/objc/base/RTCI420Buffer.h b/sdk/objc/base/RTCI420Buffer.h index a6c7e41..b97f05a 100644 --- a/sdk/objc/base/RTCI420Buffer.h +++ b/sdk/objc/base/RTCI420Buffer.h
@@ -16,7 +16,7 @@ /** Protocol for RTCYUVPlanarBuffers containing I420 data */ RTC_OBJC_EXPORT -@protocol RTCI420Buffer <RTCYUVPlanarBuffer> -@end +@protocol RTC_OBJC_TYPE +(RTCI420Buffer)<RTC_OBJC_TYPE(RTCYUVPlanarBuffer)> @end NS_ASSUME_NONNULL_END
diff --git a/sdk/objc/base/RTCMacros.h b/sdk/objc/base/RTCMacros.h index 7f7e64c..e527ff6 100644 --- a/sdk/objc/base/RTCMacros.h +++ b/sdk/objc/base/RTCMacros.h
@@ -11,6 +11,30 @@ #ifndef SDK_OBJC_BASE_RTCMACROS_H_ #define SDK_OBJC_BASE_RTCMACROS_H_ +// Internal macros used to correctly concatenate symbols. +#define RTC_SYMBOL_CONCAT_HELPER(a, b) a##b +#define RTC_SYMBOL_CONCAT(a, b) RTC_SYMBOL_CONCAT_HELPER(a, b) + +// RTC_OBJC_TYPE_PREFIX +// +// Macro used to prepend a prefix to the API types that are exported with +// RTC_OBJC_EXPORT. +// +// Clients can patch the definition of this macro locally and build +// WebRTC.framework with their own prefix in case symbol clashing is a +// problem. +// +// This macro must only be defined here and not on via compiler flag to +// ensure it has a unique value. +#define RTC_OBJC_TYPE_PREFIX + +// RCT_OBJC_TYPE +// +// Macro used internally to declare API types. Declaring an API type without +// using this macro will not include the declared type in the set of types +// that will be affected by the configurable RTC_OBJC_TYPE_PREFIX. +#define RTC_OBJC_TYPE(type_name) RTC_SYMBOL_CONCAT(RTC_OBJC_TYPE_PREFIX, type_name) + #define RTC_OBJC_EXPORT __attribute__((visibility("default"))) #if defined(__cplusplus)
diff --git a/sdk/objc/base/RTCMutableI420Buffer.h b/sdk/objc/base/RTCMutableI420Buffer.h index 098fb9a..cde7219 100644 --- a/sdk/objc/base/RTCMutableI420Buffer.h +++ b/sdk/objc/base/RTCMutableI420Buffer.h
@@ -17,7 +17,7 @@ /** Extension of the I420 buffer with mutable data access */ RTC_OBJC_EXPORT -@protocol RTCMutableI420Buffer <RTCI420Buffer, RTCMutableYUVPlanarBuffer> -@end +@protocol RTC_OBJC_TYPE +(RTCMutableI420Buffer)<RTC_OBJC_TYPE(RTCI420Buffer), RTC_OBJC_TYPE(RTCMutableYUVPlanarBuffer)> @end NS_ASSUME_NONNULL_END
diff --git a/sdk/objc/base/RTCMutableYUVPlanarBuffer.h b/sdk/objc/base/RTCMutableYUVPlanarBuffer.h index 00dfcd9..bd14e3b 100644 --- a/sdk/objc/base/RTCMutableYUVPlanarBuffer.h +++ b/sdk/objc/base/RTCMutableYUVPlanarBuffer.h
@@ -16,9 +16,10 @@ /** Extension of the YUV planar data buffer with mutable data access */ RTC_OBJC_EXPORT -@protocol RTCMutableYUVPlanarBuffer <RTCYUVPlanarBuffer> +@protocol RTC_OBJC_TYPE +(RTCMutableYUVPlanarBuffer)<RTC_OBJC_TYPE(RTCYUVPlanarBuffer)> -@property(nonatomic, readonly) uint8_t *mutableDataY; + @property(nonatomic, readonly) uint8_t *mutableDataY; @property(nonatomic, readonly) uint8_t *mutableDataU; @property(nonatomic, readonly) uint8_t *mutableDataV;
diff --git a/sdk/objc/base/RTCRtpFragmentationHeader.h b/sdk/objc/base/RTCRtpFragmentationHeader.h index 2e26b08..001b4e9 100644 --- a/sdk/objc/base/RTCRtpFragmentationHeader.h +++ b/sdk/objc/base/RTCRtpFragmentationHeader.h
@@ -16,7 +16,7 @@ /** Information for header. Corresponds to webrtc::RTPFragmentationHeader. */ RTC_OBJC_EXPORT -@interface RTCRtpFragmentationHeader : NSObject +@interface RTC_OBJC_TYPE (RTCRtpFragmentationHeader) : NSObject @property(nonatomic, strong) NSArray<NSNumber *> *fragmentationOffset; @property(nonatomic, strong) NSArray<NSNumber *> *fragmentationLength;
diff --git a/sdk/objc/base/RTCRtpFragmentationHeader.m b/sdk/objc/base/RTCRtpFragmentationHeader.m index 8049abc..60e2f5d 100644 --- a/sdk/objc/base/RTCRtpFragmentationHeader.m +++ b/sdk/objc/base/RTCRtpFragmentationHeader.m
@@ -10,11 +10,11 @@ #import "RTCRtpFragmentationHeader.h" -@implementation RTCRtpFragmentationHeader +@implementation RTC_OBJC_TYPE (RTCRtpFragmentationHeader) @synthesize fragmentationOffset = _fragmentationOffset; @synthesize fragmentationLength = _fragmentationLength; @synthesize fragmentationTimeDiff = _fragmentationTimeDiff; @synthesize fragmentationPlType = _fragmentationPlType; -@end \ No newline at end of file +@end
diff --git a/sdk/objc/base/RTCVideoCapturer.h b/sdk/objc/base/RTCVideoCapturer.h index 5212627..a1ffdcf 100644 --- a/sdk/objc/base/RTCVideoCapturer.h +++ b/sdk/objc/base/RTCVideoCapturer.h
@@ -14,19 +14,21 @@ NS_ASSUME_NONNULL_BEGIN -@class RTCVideoCapturer; +@class RTC_OBJC_TYPE(RTCVideoCapturer); RTC_OBJC_EXPORT -@protocol RTCVideoCapturerDelegate <NSObject> -- (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFrame *)frame; +@protocol RTC_OBJC_TYPE +(RTCVideoCapturerDelegate)<NSObject> - + (void)capturer : (RTC_OBJC_TYPE(RTCVideoCapturer) *)capturer didCaptureVideoFrame + : (RTC_OBJC_TYPE(RTCVideoFrame) *)frame; @end RTC_OBJC_EXPORT -@interface RTCVideoCapturer : NSObject +@interface RTC_OBJC_TYPE (RTCVideoCapturer) : NSObject -@property(nonatomic, weak) id<RTCVideoCapturerDelegate> delegate; +@property(nonatomic, weak) id<RTC_OBJC_TYPE(RTCVideoCapturerDelegate)> delegate; -- (instancetype)initWithDelegate:(id<RTCVideoCapturerDelegate>)delegate; +- (instancetype)initWithDelegate:(id<RTC_OBJC_TYPE(RTCVideoCapturerDelegate)>)delegate; @end
diff --git a/sdk/objc/base/RTCVideoCapturer.m b/sdk/objc/base/RTCVideoCapturer.m index 39cc377..ca31a73 100644 --- a/sdk/objc/base/RTCVideoCapturer.m +++ b/sdk/objc/base/RTCVideoCapturer.m
@@ -10,11 +10,11 @@ #import "RTCVideoCapturer.h" -@implementation RTCVideoCapturer +@implementation RTC_OBJC_TYPE (RTCVideoCapturer) @synthesize delegate = _delegate; -- (instancetype)initWithDelegate:(id<RTCVideoCapturerDelegate>)delegate { +- (instancetype)initWithDelegate:(id<RTC_OBJC_TYPE(RTCVideoCapturerDelegate)>)delegate { if (self = [super init]) { _delegate = delegate; }
diff --git a/sdk/objc/base/RTCVideoCodecInfo.h b/sdk/objc/base/RTCVideoCodecInfo.h index 2162caa..fa28958 100644 --- a/sdk/objc/base/RTCVideoCodecInfo.h +++ b/sdk/objc/base/RTCVideoCodecInfo.h
@@ -16,7 +16,7 @@ /** Holds information to identify a codec. Corresponds to webrtc::SdpVideoFormat. */ RTC_OBJC_EXPORT -@interface RTCVideoCodecInfo : NSObject <NSCoding> +@interface RTC_OBJC_TYPE (RTCVideoCodecInfo) : NSObject <NSCoding> - (instancetype)init NS_UNAVAILABLE; @@ -26,7 +26,7 @@ parameters:(nullable NSDictionary<NSString *, NSString *> *)parameters NS_DESIGNATED_INITIALIZER; -- (BOOL)isEqualToCodecInfo:(RTCVideoCodecInfo *)info; +- (BOOL)isEqualToCodecInfo:(RTC_OBJC_TYPE(RTCVideoCodecInfo) *)info; @property(nonatomic, readonly) NSString *name; @property(nonatomic, readonly) NSDictionary<NSString *, NSString *> *parameters;
diff --git a/sdk/objc/base/RTCVideoCodecInfo.m b/sdk/objc/base/RTCVideoCodecInfo.m index 7fb17ca..ce26ae1 100644 --- a/sdk/objc/base/RTCVideoCodecInfo.m +++ b/sdk/objc/base/RTCVideoCodecInfo.m
@@ -10,7 +10,7 @@ #import "RTCVideoCodecInfo.h" -@implementation RTCVideoCodecInfo +@implementation RTC_OBJC_TYPE (RTCVideoCodecInfo) @synthesize name = _name; @synthesize parameters = _parameters; @@ -29,7 +29,7 @@ return self; } -- (BOOL)isEqualToCodecInfo:(RTCVideoCodecInfo *)info { +- (BOOL)isEqualToCodecInfo:(RTC_OBJC_TYPE(RTCVideoCodecInfo) *)info { if (!info || ![self.name isEqualToString:info.name] || ![self.parameters isEqualToDictionary:info.parameters]) {
diff --git a/sdk/objc/base/RTCVideoDecoder.h b/sdk/objc/base/RTCVideoDecoder.h index 8077c69..ccddd42 100644 --- a/sdk/objc/base/RTCVideoDecoder.h +++ b/sdk/objc/base/RTCVideoDecoder.h
@@ -19,18 +19,19 @@ NS_ASSUME_NONNULL_BEGIN /** Callback block for decoder. */ -typedef void (^RTCVideoDecoderCallback)(RTCVideoFrame *frame); +typedef void (^RTCVideoDecoderCallback)(RTC_OBJC_TYPE(RTCVideoFrame) * frame); /** Protocol for decoder implementations. */ RTC_OBJC_EXPORT -@protocol RTCVideoDecoder <NSObject> +@protocol RTC_OBJC_TYPE +(RTCVideoDecoder)<NSObject> -- (void)setCallback:(RTCVideoDecoderCallback)callback; + - (void)setCallback : (RTCVideoDecoderCallback)callback; - (NSInteger)startDecodeWithNumberOfCores:(int)numberOfCores; - (NSInteger)releaseDecoder; -- (NSInteger)decode:(RTCEncodedImage *)encodedImage +- (NSInteger)decode:(RTC_OBJC_TYPE(RTCEncodedImage) *)encodedImage missingFrames:(BOOL)missingFrames - codecSpecificInfo:(nullable id<RTCCodecSpecificInfo>)info + codecSpecificInfo:(nullable id<RTC_OBJC_TYPE(RTCCodecSpecificInfo)>)info renderTimeMs:(int64_t)renderTimeMs; - (NSString *)implementationName;
diff --git a/sdk/objc/base/RTCVideoDecoderFactory.h b/sdk/objc/base/RTCVideoDecoderFactory.h index 3e24153..8d90138 100644 --- a/sdk/objc/base/RTCVideoDecoderFactory.h +++ b/sdk/objc/base/RTCVideoDecoderFactory.h
@@ -16,12 +16,16 @@ NS_ASSUME_NONNULL_BEGIN -/** RTCVideoDecoderFactory is an Objective-C version of webrtc::VideoDecoderFactory. */ +/** RTCVideoDecoderFactory is an Objective-C version of webrtc::VideoDecoderFactory. + */ RTC_OBJC_EXPORT -@protocol RTCVideoDecoderFactory <NSObject> +@protocol RTC_OBJC_TYPE +(RTCVideoDecoderFactory)<NSObject> -- (nullable id<RTCVideoDecoder>)createDecoder:(RTCVideoCodecInfo *)info; -- (NSArray<RTCVideoCodecInfo *> *)supportedCodecs; // TODO(andersc): "supportedFormats" instead? + - (nullable id<RTC_OBJC_TYPE(RTCVideoDecoder)>)createDecoder + : (RTC_OBJC_TYPE(RTCVideoCodecInfo) *)info; +- (NSArray<RTC_OBJC_TYPE(RTCVideoCodecInfo) *> *) + supportedCodecs; // TODO(andersc): "supportedFormats" instead? @end
diff --git a/sdk/objc/base/RTCVideoEncoder.h b/sdk/objc/base/RTCVideoEncoder.h index c525767..7d1a7af 100644 --- a/sdk/objc/base/RTCVideoEncoder.h +++ b/sdk/objc/base/RTCVideoEncoder.h
@@ -21,20 +21,21 @@ NS_ASSUME_NONNULL_BEGIN /** Callback block for encoder. */ -typedef BOOL (^RTCVideoEncoderCallback)(RTCEncodedImage *frame, - id<RTCCodecSpecificInfo> info, - RTCRtpFragmentationHeader *header); +typedef BOOL (^RTCVideoEncoderCallback)(RTC_OBJC_TYPE(RTCEncodedImage) * frame, + id<RTC_OBJC_TYPE(RTCCodecSpecificInfo)> info, + RTC_OBJC_TYPE(RTCRtpFragmentationHeader) * header); /** Protocol for encoder implementations. */ RTC_OBJC_EXPORT -@protocol RTCVideoEncoder <NSObject> +@protocol RTC_OBJC_TYPE +(RTCVideoEncoder)<NSObject> -- (void)setCallback:(RTCVideoEncoderCallback)callback; -- (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings + - (void)setCallback : (RTCVideoEncoderCallback)callback; +- (NSInteger)startEncodeWithSettings:(RTC_OBJC_TYPE(RTCVideoEncoderSettings) *)settings numberOfCores:(int)numberOfCores; - (NSInteger)releaseEncoder; -- (NSInteger)encode:(RTCVideoFrame *)frame - codecSpecificInfo:(nullable id<RTCCodecSpecificInfo>)info +- (NSInteger)encode:(RTC_OBJC_TYPE(RTCVideoFrame) *)frame + codecSpecificInfo:(nullable id<RTC_OBJC_TYPE(RTCCodecSpecificInfo)>)info frameTypes:(NSArray<NSNumber *> *)frameTypes; - (int)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate; - (NSString *)implementationName; @@ -42,7 +43,7 @@ /** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to * keep the QP from the encoded images within the given range. Returning nil from this function * disables quality scaling. */ -- (nullable RTCVideoEncoderQpThresholds *)scalingSettings; +- (nullable RTC_OBJC_TYPE(RTCVideoEncoderQpThresholds) *)scalingSettings; @end
diff --git a/sdk/objc/base/RTCVideoEncoderFactory.h b/sdk/objc/base/RTCVideoEncoderFactory.h index 6ea78a5..b115b2a 100644 --- a/sdk/objc/base/RTCVideoEncoderFactory.h +++ b/sdk/objc/base/RTCVideoEncoderFactory.h
@@ -20,24 +20,29 @@ webrtc::VideoEncoderFactory::VideoEncoderSelector. */ RTC_OBJC_EXPORT -@protocol RTCVideoEncoderSelector <NSObject> +@protocol RTC_OBJC_TYPE +(RTCVideoEncoderSelector)<NSObject> -- (void)registerCurrentEncoderInfo:(RTCVideoCodecInfo *)info; -- (nullable RTCVideoCodecInfo *)encoderForBitrate:(NSInteger)bitrate; -- (nullable RTCVideoCodecInfo *)encoderForBrokenEncoder; + - (void)registerCurrentEncoderInfo : (RTC_OBJC_TYPE(RTCVideoCodecInfo) *)info; +- (nullable RTC_OBJC_TYPE(RTCVideoCodecInfo) *)encoderForBitrate:(NSInteger)bitrate; +- (nullable RTC_OBJC_TYPE(RTCVideoCodecInfo) *)encoderForBrokenEncoder; @end -/** RTCVideoEncoderFactory is an Objective-C version of webrtc::VideoEncoderFactory. */ +/** RTCVideoEncoderFactory is an Objective-C version of webrtc::VideoEncoderFactory. + */ RTC_OBJC_EXPORT -@protocol RTCVideoEncoderFactory <NSObject> +@protocol RTC_OBJC_TYPE +(RTCVideoEncoderFactory)<NSObject> -- (nullable id<RTCVideoEncoder>)createEncoder:(RTCVideoCodecInfo *)info; -- (NSArray<RTCVideoCodecInfo *> *)supportedCodecs; // TODO(andersc): "supportedFormats" instead? + - (nullable id<RTC_OBJC_TYPE(RTCVideoEncoder)>)createEncoder + : (RTC_OBJC_TYPE(RTCVideoCodecInfo) *)info; +- (NSArray<RTC_OBJC_TYPE(RTCVideoCodecInfo) *> *) + supportedCodecs; // TODO(andersc): "supportedFormats" instead? @optional -- (NSArray<RTCVideoCodecInfo *> *)implementations; -- (nullable id<RTCVideoEncoderSelector>)encoderSelector; +- (NSArray<RTC_OBJC_TYPE(RTCVideoCodecInfo) *> *)implementations; +- (nullable id<RTC_OBJC_TYPE(RTCVideoEncoderSelector)>)encoderSelector; @end
diff --git a/sdk/objc/base/RTCVideoEncoderQpThresholds.h b/sdk/objc/base/RTCVideoEncoderQpThresholds.h index 2b48f45..1a6e9e8 100644 --- a/sdk/objc/base/RTCVideoEncoderQpThresholds.h +++ b/sdk/objc/base/RTCVideoEncoderQpThresholds.h
@@ -16,7 +16,7 @@ /** QP thresholds for encoder. Corresponds to webrtc::VideoEncoder::QpThresholds. */ RTC_OBJC_EXPORT -@interface RTCVideoEncoderQpThresholds : NSObject +@interface RTC_OBJC_TYPE (RTCVideoEncoderQpThresholds) : NSObject - (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high;
diff --git a/sdk/objc/base/RTCVideoEncoderQpThresholds.m b/sdk/objc/base/RTCVideoEncoderQpThresholds.m index 5bd06ff..fb7012f 100644 --- a/sdk/objc/base/RTCVideoEncoderQpThresholds.m +++ b/sdk/objc/base/RTCVideoEncoderQpThresholds.m
@@ -10,7 +10,7 @@ #import "RTCVideoEncoderQpThresholds.h" -@implementation RTCVideoEncoderQpThresholds +@implementation RTC_OBJC_TYPE (RTCVideoEncoderQpThresholds) @synthesize low = _low; @synthesize high = _high;
diff --git a/sdk/objc/base/RTCVideoEncoderSettings.h b/sdk/objc/base/RTCVideoEncoderSettings.h index a9403f8..ae792ea 100644 --- a/sdk/objc/base/RTCVideoEncoderSettings.h +++ b/sdk/objc/base/RTCVideoEncoderSettings.h
@@ -21,7 +21,7 @@ /** Settings for encoder. Corresponds to webrtc::VideoCodec. */ RTC_OBJC_EXPORT -@interface RTCVideoEncoderSettings : NSObject +@interface RTC_OBJC_TYPE (RTCVideoEncoderSettings) : NSObject @property(nonatomic, strong) NSString *name;
diff --git a/sdk/objc/base/RTCVideoEncoderSettings.m b/sdk/objc/base/RTCVideoEncoderSettings.m index f68bc8c..f66cd2c 100644 --- a/sdk/objc/base/RTCVideoEncoderSettings.m +++ b/sdk/objc/base/RTCVideoEncoderSettings.m
@@ -10,7 +10,7 @@ #import "RTCVideoEncoderSettings.h" -@implementation RTCVideoEncoderSettings +@implementation RTC_OBJC_TYPE (RTCVideoEncoderSettings) @synthesize name = _name; @synthesize width = _width;
diff --git a/sdk/objc/base/RTCVideoFrame.h b/sdk/objc/base/RTCVideoFrame.h index 9aca743..f5638d2 100644 --- a/sdk/objc/base/RTCVideoFrame.h +++ b/sdk/objc/base/RTCVideoFrame.h
@@ -22,11 +22,12 @@ RTCVideoRotation_270 = 270, }; -@protocol RTCVideoFrameBuffer; +@protocol RTC_OBJC_TYPE +(RTCVideoFrameBuffer); // RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame. RTC_OBJC_EXPORT -@interface RTCVideoFrame : NSObject +@interface RTC_OBJC_TYPE (RTCVideoFrame) : NSObject /** Width without rotation applied. */ @property(nonatomic, readonly) int width; @@ -41,7 +42,7 @@ /** Timestamp 90 kHz. */ @property(nonatomic, assign) int32_t timeStamp; -@property(nonatomic, readonly) id<RTCVideoFrameBuffer> buffer; +@property(nonatomic, readonly) id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)> buffer; - (instancetype)init NS_UNAVAILABLE; - (instancetype) new NS_UNAVAILABLE; @@ -71,14 +72,14 @@ /** Initialize an RTCVideoFrame from a frame buffer, rotation, and timestamp. */ -- (instancetype)initWithBuffer:(id<RTCVideoFrameBuffer>)frameBuffer +- (instancetype)initWithBuffer:(id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)>)frameBuffer rotation:(RTCVideoRotation)rotation timeStampNs:(int64_t)timeStampNs; /** Return a frame that is guaranteed to be I420, i.e. it is possible to access * the YUV data on it. */ -- (RTCVideoFrame *)newI420VideoFrame; +- (RTC_OBJC_TYPE(RTCVideoFrame) *)newI420VideoFrame; @end
diff --git a/sdk/objc/base/RTCVideoFrame.mm b/sdk/objc/base/RTCVideoFrame.mm index 0a44b04..e162238 100644 --- a/sdk/objc/base/RTCVideoFrame.mm +++ b/sdk/objc/base/RTCVideoFrame.mm
@@ -13,7 +13,7 @@ #import "RTCI420Buffer.h" #import "RTCVideoFrameBuffer.h" -@implementation RTCVideoFrame { +@implementation RTC_OBJC_TYPE (RTCVideoFrame) { RTCVideoRotation _rotation; int64_t _timeStampNs; } @@ -37,10 +37,10 @@ return _timeStampNs; } -- (RTCVideoFrame *)newI420VideoFrame { - return [[RTCVideoFrame alloc] initWithBuffer:[_buffer toI420] - rotation:_rotation - timeStampNs:_timeStampNs]; +- (RTC_OBJC_TYPE(RTCVideoFrame) *)newI420VideoFrame { + return [[RTC_OBJC_TYPE(RTCVideoFrame) alloc] initWithBuffer:[_buffer toI420] + rotation:_rotation + timeStampNs:_timeStampNs]; } - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer @@ -63,7 +63,7 @@ return nil; } -- (instancetype)initWithBuffer:(id<RTCVideoFrameBuffer>)buffer +- (instancetype)initWithBuffer:(id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)>)buffer rotation:(RTCVideoRotation)rotation timeStampNs:(int64_t)timeStampNs { if (self = [super init]) {
diff --git a/sdk/objc/base/RTCVideoFrameBuffer.h b/sdk/objc/base/RTCVideoFrameBuffer.h index bb9e6fb..82d057e 100644 --- a/sdk/objc/base/RTCVideoFrameBuffer.h +++ b/sdk/objc/base/RTCVideoFrameBuffer.h
@@ -14,16 +14,18 @@ NS_ASSUME_NONNULL_BEGIN -@protocol RTCI420Buffer; +@protocol RTC_OBJC_TYPE +(RTCI420Buffer); // RTCVideoFrameBuffer is an ObjectiveC version of webrtc::VideoFrameBuffer. RTC_OBJC_EXPORT -@protocol RTCVideoFrameBuffer <NSObject> +@protocol RTC_OBJC_TYPE +(RTCVideoFrameBuffer)<NSObject> -@property(nonatomic, readonly) int width; + @property(nonatomic, readonly) int width; @property(nonatomic, readonly) int height; -- (id<RTCI420Buffer>)toI420; +- (id<RTC_OBJC_TYPE(RTCI420Buffer)>)toI420; @end
diff --git a/sdk/objc/base/RTCVideoRenderer.h b/sdk/objc/base/RTCVideoRenderer.h index 7b359a3..0f76329 100644 --- a/sdk/objc/base/RTCVideoRenderer.h +++ b/sdk/objc/base/RTCVideoRenderer.h
@@ -17,23 +17,26 @@ NS_ASSUME_NONNULL_BEGIN -@class RTCVideoFrame; +@class RTC_OBJC_TYPE(RTCVideoFrame); RTC_OBJC_EXPORT -@protocol RTCVideoRenderer <NSObject> +@protocol RTC_OBJC_TYPE +(RTCVideoRenderer)<NSObject> -/** The size of the frame. */ -- (void)setSize:(CGSize)size; + /** The size of the frame. */ + - (void)setSize : (CGSize)size; /** The frame to be displayed. */ -- (void)renderFrame:(nullable RTCVideoFrame *)frame; +- (void)renderFrame:(nullable RTC_OBJC_TYPE(RTCVideoFrame) *)frame; @end RTC_OBJC_EXPORT -@protocol RTCVideoViewDelegate +@protocol RTC_OBJC_TYPE +(RTCVideoViewDelegate) -- (void)videoView:(id<RTCVideoRenderer>)videoView didChangeVideoSize:(CGSize)size; + - (void)videoView : (id<RTC_OBJC_TYPE(RTCVideoRenderer)>)videoView didChangeVideoSize + : (CGSize)size; @end
diff --git a/sdk/objc/base/RTCYUVPlanarBuffer.h b/sdk/objc/base/RTCYUVPlanarBuffer.h index 8ceb66c..be01b91 100644 --- a/sdk/objc/base/RTCYUVPlanarBuffer.h +++ b/sdk/objc/base/RTCYUVPlanarBuffer.h
@@ -17,9 +17,10 @@ /** Protocol for RTCVideoFrameBuffers containing YUV planar data. */ RTC_OBJC_EXPORT -@protocol RTCYUVPlanarBuffer <RTCVideoFrameBuffer> +@protocol RTC_OBJC_TYPE +(RTCYUVPlanarBuffer)<RTC_OBJC_TYPE(RTCVideoFrameBuffer)> -@property(nonatomic, readonly) int chromaWidth; + @property(nonatomic, readonly) int chromaWidth; @property(nonatomic, readonly) int chromaHeight; @property(nonatomic, readonly) const uint8_t *dataY; @property(nonatomic, readonly) const uint8_t *dataU;