From 6b03995bef36642911c56f49683b6ab1973be680 Mon Sep 17 00:00:00 2001 From: hjon Date: Thu, 25 Feb 2016 12:32:58 -0800 Subject: [PATCH] Compile rtc_api_objc on Mac. BUG= Review URL: https://codereview.webrtc.org/1726213002 Cr-Commit-Position: refs/heads/master@{#11771} --- webrtc/api/api.gyp | 20 ++--- webrtc/api/api_tests.gyp | 8 +- webrtc/api/objc/RTCConfiguration.h | 7 +- webrtc/api/objc/RTCIceCandidate.h | 11 +-- webrtc/api/objc/RTCIceServer.h | 16 ++-- webrtc/api/objc/RTCIceServer.mm | 7 +- webrtc/api/objc/RTCMediaConstraints+Private.h | 5 +- webrtc/api/objc/RTCMediaConstraints.h | 16 ++-- webrtc/api/objc/RTCMediaConstraints.mm | 24 ++++-- webrtc/api/objc/RTCMediaStream.h | 7 +- webrtc/api/objc/RTCMediaStream.mm | 8 +- webrtc/api/objc/RTCPeerConnection+Stats.mm | 11 ++- webrtc/api/objc/RTCPeerConnection.h | 85 +++++++++++-------- webrtc/api/objc/RTCStatsReport.h | 4 +- webrtc/api/objc/RTCStatsReport.mm | 7 +- webrtc/api/objc/RTCVideoFrame.h | 3 +- webrtc/api/objc/WebRTC-Prefix.pch | 13 --- .../api/objctests/RTCMediaConstraintsTest.mm | 2 +- 18 files changed, 147 insertions(+), 107 deletions(-) delete mode 100644 webrtc/api/objc/WebRTC-Prefix.pch diff --git a/webrtc/api/api.gyp b/webrtc/api/api.gyp index c9add179fe..4fe8ce8458 100644 --- a/webrtc/api/api.gyp +++ b/webrtc/api/api.gyp @@ -122,19 +122,19 @@ }, # libjingle_peerconnection_java ] }], - ['OS=="ios"', { + ['OS=="ios" or (OS=="mac" and mac_deployment_target=="10.7")', { 'targets': [ { 'target_name': 'rtc_api_objc', 'type': 'static_library', + 'includes': [ + '../build/objc_common.gypi', + ], 'dependencies': [ '<(webrtc_root)/base/base.gyp:rtc_base_objc', 'libjingle_peerconnection', ], 'sources': [ - 'objc/RTCAVFoundationVideoSource+Private.h', - 'objc/RTCAVFoundationVideoSource.h', - 'objc/RTCAVFoundationVideoSource.mm', 'objc/RTCAudioTrack+Private.h', 'objc/RTCAudioTrack.h', 'objc/RTCAudioTrack.mm', @@ -191,14 +191,17 @@ 'objc/RTCVideoTrack+Private.h', 'objc/RTCVideoTrack.h', 'objc/RTCVideoTrack.mm', - 'objc/avfoundationvideocapturer.h', - 'objc/avfoundationvideocapturer.mm', ], 'conditions': [ ['OS=="ios"', { 'sources': [ + 'objc/RTCAVFoundationVideoSource+Private.h', + 'objc/RTCAVFoundationVideoSource.h', + 'objc/RTCAVFoundationVideoSource.mm', 'objc/RTCEAGLVideoView.h', 'objc/RTCEAGLVideoView.m', + 'objc/avfoundationvideocapturer.h', + 'objc/avfoundationvideocapturer.mm', ], 'all_dependent_settings': { 'xcode_settings': { @@ -228,11 +231,6 @@ ], }], ], - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES', - 'GCC_PREFIX_HEADER': 'objc/WebRTC-Prefix.pch', - }, } ], }], # OS=="ios" diff --git a/webrtc/api/api_tests.gyp b/webrtc/api/api_tests.gyp index 5af1cabfeb..ada036a2b5 100644 --- a/webrtc/api/api_tests.gyp +++ b/webrtc/api/api_tests.gyp @@ -137,11 +137,14 @@ }, ], # targets }], # OS=="android" - ['OS=="ios"', { + ['OS=="ios" or (OS=="mac" and mac_deployment_target=="10.7")', { 'targets': [ { 'target_name': 'rtc_api_objc_tests', 'type': 'executable', + 'includes': [ + '../build/objc_common.gypi', + ], 'dependencies': [ '<(webrtc_root)/api/api.gyp:rtc_api_objc', '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils', @@ -155,9 +158,6 @@ 'objctests/RTCSessionDescriptionTest.mm', ], 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - 'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES', - 'GCC_PREFIX_HEADER': 'objc/WebRTC-Prefix.pch', # |-ObjC| flag needed to make sure category method implementations # are included: # https://developer.apple.com/library/mac/qa/qa1490/_index.html diff --git a/webrtc/api/objc/RTCConfiguration.h b/webrtc/api/objc/RTCConfiguration.h index 144c8d3bd5..ed4bfc2748 100644 --- a/webrtc/api/objc/RTCConfiguration.h +++ b/webrtc/api/objc/RTCConfiguration.h @@ -12,6 +12,8 @@ @class RTCIceServer; +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 + /** * Represents the ice transport policy. This exposes the same states in C++, * which include one more state than what exists in the W3C spec. @@ -53,7 +55,8 @@ NS_ASSUME_NONNULL_BEGIN @interface RTCConfiguration : NSObject /** An array of Ice Servers available to be used by ICE. */ -@property(nonatomic, copy) NSArray *iceServers; +@property(nonatomic, copy, nonnull) NSArray *iceServers; +// @property(nonatomic, copy) NSArray *iceServers; /** Which candidates the ICE agent is allowed to use. The W3C calls it * |iceTransportPolicy|, while in C++ it is called |type|. */ @@ -72,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN /** Key type used to generate SSL identity. Default is ECDSA. */ @property(nonatomic, assign) RTCEncryptionKeyType keyType; -- (instancetype)init NS_DESIGNATED_INITIALIZER; +- (nonnull instancetype)init NS_DESIGNATED_INITIALIZER; @end diff --git a/webrtc/api/objc/RTCIceCandidate.h b/webrtc/api/objc/RTCIceCandidate.h index 41ea69e991..f7e27c21bb 100644 --- a/webrtc/api/objc/RTCIceCandidate.h +++ b/webrtc/api/objc/RTCIceCandidate.h @@ -11,6 +11,7 @@ #import NS_ASSUME_NONNULL_BEGIN +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 @interface RTCIceCandidate : NSObject @@ -27,16 +28,16 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, readonly) NSInteger sdpMLineIndex; /** The SDP string for this candidate. */ -@property(nonatomic, readonly) NSString *sdp; +@property(nonatomic, readonly, nonnull) NSString *sdp; -- (instancetype)init NS_UNAVAILABLE; +- (nonnull instancetype)init NS_UNAVAILABLE; /** * Initialize an RTCIceCandidate from SDP. */ -- (instancetype)initWithSdp:(NSString *)sdp - sdpMLineIndex:(NSInteger)sdpMLineIndex - sdpMid:(nullable NSString *)sdpMid +- (nonnull instancetype)initWithSdp:(nonnull NSString *)sdp + sdpMLineIndex:(NSInteger)sdpMLineIndex + sdpMid:(nullable NSString *)sdpMid NS_DESIGNATED_INITIALIZER; @end diff --git a/webrtc/api/objc/RTCIceServer.h b/webrtc/api/objc/RTCIceServer.h index be4e0d7b6e..94e3497aea 100644 --- a/webrtc/api/objc/RTCIceServer.h +++ b/webrtc/api/objc/RTCIceServer.h @@ -11,11 +11,13 @@ #import NS_ASSUME_NONNULL_BEGIN +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 @interface RTCIceServer : NSObject /** URI(s) for this server represented as NSStrings. */ -@property(nonatomic, copy, readonly) NSArray *urlStrings; +@property(nonatomic, copy, readonly, nonnull) NSArray *urlStrings; +// @property(nonatomic, copy, readonly) NSArray *urlStrings; /** Username to use if this RTCIceServer object is a TURN server. */ @property(nonatomic, copy, readonly, nullable) NSString *username; @@ -23,18 +25,20 @@ NS_ASSUME_NONNULL_BEGIN /** Credential to use if this RTCIceServer object is a TURN server. */ @property(nonatomic, copy, readonly, nullable) NSString *credential; -- (instancetype)init NS_UNAVAILABLE; +- (nonnull instancetype)init NS_UNAVAILABLE; /** Convenience initializer for a server with no authentication (e.g. STUN). */ -- (instancetype)initWithURLStrings:(NSArray *)urlStrings; +- (nonnull instancetype)initWithURLStrings:(nonnull NSArray *)urlStrings; +// - (instancetype)initWithURLStrings:(NSArray *)urlStrings; /** * Initialize an RTCIceServer with its associated URLs, optional username, * optional credential, and credentialType. */ -- (instancetype)initWithURLStrings:(NSArray *)urlStrings - username:(nullable NSString *)username - credential:(nullable NSString *)credential +- (nonnull instancetype)initWithURLStrings:(nonnull NSArray *)urlStrings +// - (instancetype)initWithURLStrings:(NSArray *)urlStrings + username:(nullable NSString *)username + credential:(nullable NSString *)credential NS_DESIGNATED_INITIALIZER; @end diff --git a/webrtc/api/objc/RTCIceServer.mm b/webrtc/api/objc/RTCIceServer.mm index 057c69603b..bdac700e55 100644 --- a/webrtc/api/objc/RTCIceServer.mm +++ b/webrtc/api/objc/RTCIceServer.mm @@ -14,19 +14,22 @@ #import "webrtc/base/objc/NSString+StdString.h" @implementation RTCIceServer +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 @synthesize urlStrings = _urlStrings; @synthesize username = _username; @synthesize credential = _credential; -- (instancetype)initWithURLStrings:(NSArray *)urlStrings { +- (instancetype)initWithURLStrings:(NSArray *)urlStrings { +// - (instancetype)initWithURLStrings:(NSArray *)urlStrings { NSParameterAssert(urlStrings.count); return [self initWithURLStrings:urlStrings username:nil credential:nil]; } -- (instancetype)initWithURLStrings:(NSArray *)urlStrings +- (instancetype)initWithURLStrings:(NSArray *)urlStrings +// - (instancetype)initWithURLStrings:(NSArray *)urlStrings username:(NSString *)username credential:(NSString *)credential { NSParameterAssert(urlStrings.count); diff --git a/webrtc/api/objc/RTCMediaConstraints+Private.h b/webrtc/api/objc/RTCMediaConstraints+Private.h index fa582ecae5..84966d137a 100644 --- a/webrtc/api/objc/RTCMediaConstraints+Private.h +++ b/webrtc/api/objc/RTCMediaConstraints+Private.h @@ -13,6 +13,8 @@ #include "webrtc/api/mediaconstraintsinterface.h" #include "webrtc/base/scoped_ptr.h" +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 + namespace webrtc { class MediaConstraints : public MediaConstraintsInterface { @@ -46,7 +48,8 @@ NS_ASSUME_NONNULL_BEGIN /** Return a native Constraints object representing these constraints */ + (webrtc::MediaConstraintsInterface::Constraints) nativeConstraintsForConstraints: - (NSDictionary *)constraints; + (NSDictionary *)constraints; + // (NSDictionary *)constraints; @end diff --git a/webrtc/api/objc/RTCMediaConstraints.h b/webrtc/api/objc/RTCMediaConstraints.h index a8ad39142e..1ed456cf4e 100644 --- a/webrtc/api/objc/RTCMediaConstraints.h +++ b/webrtc/api/objc/RTCMediaConstraints.h @@ -11,17 +11,23 @@ #import NS_ASSUME_NONNULL_BEGIN +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 @interface RTCMediaConstraints : NSObject -- (instancetype)init NS_UNAVAILABLE; +- (nonnull instancetype)init NS_UNAVAILABLE; /** Initialize with mandatory and/or optional constraints. */ -- (instancetype)initWithMandatoryConstraints: - (nullable NSDictionary *)mandatory - optionalConstraints: - (nullable NSDictionary *)optional +- (nonnull instancetype)initWithMandatoryConstraints: + (nullable NSDictionary *)mandatory + optionalConstraints: + (nullable NSDictionary *)optional NS_DESIGNATED_INITIALIZER; +// - (instancetype)initWithMandatoryConstraints: +// (nullable NSDictionary *)mandatory +// optionalConstraints: +// (nullable NSDictionary *)optional +// NS_DESIGNATED_INITIALIZER; @end diff --git a/webrtc/api/objc/RTCMediaConstraints.mm b/webrtc/api/objc/RTCMediaConstraints.mm index a53a517747..9d4e391d10 100644 --- a/webrtc/api/objc/RTCMediaConstraints.mm +++ b/webrtc/api/objc/RTCMediaConstraints.mm @@ -13,6 +13,8 @@ #import "webrtc/api/objc/RTCMediaConstraints+Private.h" #import "webrtc/base/objc/NSString+StdString.h" +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 + namespace webrtc { MediaConstraints::~MediaConstraints() {} @@ -38,14 +40,18 @@ MediaConstraints::GetOptional() const { @implementation RTCMediaConstraints { - NSDictionary *_mandatory; - NSDictionary *_optional; + NSDictionary *_mandatory; + // NSDictionary *_mandatory; + NSDictionary *_optional; + // NSDictionary *_optional; } - (instancetype)initWithMandatoryConstraints: - (NSDictionary *)mandatory + (NSDictionary *)mandatory + // (NSDictionary *)mandatory optionalConstraints: - (NSDictionary *)optional { + (NSDictionary *)optional { + // (NSDictionary *)optional { if (self = [super init]) { _mandatory = [[NSDictionary alloc] initWithDictionary:mandatory copyItems:YES]; @@ -76,15 +82,17 @@ MediaConstraints::GetOptional() const { + (webrtc::MediaConstraintsInterface::Constraints) nativeConstraintsForConstraints: - (NSDictionary *)constraints { + (NSDictionary *)constraints { + // (NSDictionary *)constraints { webrtc::MediaConstraintsInterface::Constraints nativeConstraints; for (NSString *key in constraints) { NSAssert([key isKindOfClass:[NSString class]], @"%@ is not an NSString.", key); - NSAssert([constraints[key] isKindOfClass:[NSString class]], - @"%@ is not an NSString.", constraints[key]); + NSString *value = [constraints objectForKey:key]; + NSAssert([value isKindOfClass:[NSString class]], + @"%@ is not an NSString.", value); nativeConstraints.push_back(webrtc::MediaConstraintsInterface::Constraint( - key.stdString, constraints[key].stdString)); + key.stdString, value.stdString)); } return nativeConstraints; } diff --git a/webrtc/api/objc/RTCMediaStream.h b/webrtc/api/objc/RTCMediaStream.h index c63f9ed443..b314360434 100644 --- a/webrtc/api/objc/RTCMediaStream.h +++ b/webrtc/api/objc/RTCMediaStream.h @@ -11,6 +11,7 @@ #import NS_ASSUME_NONNULL_BEGIN +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 @class RTCAudioTrack; @class RTCVideoTrack; @@ -18,10 +19,12 @@ NS_ASSUME_NONNULL_BEGIN @interface RTCMediaStream : NSObject /** The audio tracks in this stream. */ -@property(nonatomic, strong, readonly) NSArray *audioTracks; +@property(nonatomic, strong, readonly) NSArray *audioTracks; +// @property(nonatomic, strong, readonly) NSArray *audioTracks; /** The video tracks in this stream. */ -@property(nonatomic, strong, readonly) NSArray *videoTracks; +@property(nonatomic, strong, readonly) NSArray *videoTracks; +// @property(nonatomic, strong, readonly) NSArray *videoTracks; /** An identifier for this media stream. */ @property(nonatomic, readonly) NSString *streamId; diff --git a/webrtc/api/objc/RTCMediaStream.mm b/webrtc/api/objc/RTCMediaStream.mm index 2c24d78759..dcdef9d1a4 100644 --- a/webrtc/api/objc/RTCMediaStream.mm +++ b/webrtc/api/objc/RTCMediaStream.mm @@ -18,17 +18,21 @@ #import "webrtc/api/objc/RTCVideoTrack+Private.h" #import "webrtc/base/objc/NSString+StdString.h" +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 + @implementation RTCMediaStream { NSMutableArray *_audioTracks; NSMutableArray *_videoTracks; rtc::scoped_refptr _nativeMediaStream; } -- (NSArray *)audioTracks { +- (NSArray *)audioTracks { +// - (NSArray *)audioTracks { return [_audioTracks copy]; } -- (NSArray *)videoTracks { +- (NSArray *)videoTracks { +// - (NSArray *)videoTracks { return [_videoTracks copy]; } diff --git a/webrtc/api/objc/RTCPeerConnection+Stats.mm b/webrtc/api/objc/RTCPeerConnection+Stats.mm index 5032c84e54..6a506d4aaa 100644 --- a/webrtc/api/objc/RTCPeerConnection+Stats.mm +++ b/webrtc/api/objc/RTCPeerConnection+Stats.mm @@ -16,12 +16,15 @@ #import "webrtc/api/objc/RTCStatsReport+Private.h" #import "webrtc/base/objc/NSString+StdString.h" +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 + namespace webrtc { class StatsObserverAdapter : public StatsObserver { public: StatsObserverAdapter(void (^completionHandler) - (NSArray *stats)) { + (NSArray *stats)) { + // (NSArray *stats)) { completion_handler_ = completionHandler; } @@ -42,7 +45,8 @@ class StatsObserverAdapter : public StatsObserver { } private: - void (^completion_handler_)(NSArray *stats); + void (^completion_handler_)(NSArray *stats); + // void (^completion_handler_)(NSArray *stats); }; } // namespace webrtc @@ -51,7 +55,8 @@ class StatsObserverAdapter : public StatsObserver { - (void)statsForTrack:(RTCMediaStreamTrack *)mediaStreamTrack statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel completionHandler: - (void (^)(NSArray *stats))completionHandler { + (void (^)(NSArray *stats))completionHandler { + // (void (^)(NSArray *stats))completionHandler { rtc::scoped_refptr observer( new rtc::RefCountedObject (completionHandler)); diff --git a/webrtc/api/objc/RTCPeerConnection.h b/webrtc/api/objc/RTCPeerConnection.h index 46cb0855eb..86668a5b21 100644 --- a/webrtc/api/objc/RTCPeerConnection.h +++ b/webrtc/api/objc/RTCPeerConnection.h @@ -22,8 +22,9 @@ @class RTCStatsReport; NS_ASSUME_NONNULL_BEGIN +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 -extern NSString * const kRTCPeerConnectionErrorDomain; +extern NSString * _Nonnull const kRTCPeerConnectionErrorDomain; extern int const kRTCSessionDescriptionErrorCode; /** Represents the signaling state of the peer connection. */ @@ -66,35 +67,36 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) { @protocol RTCPeerConnectionDelegate /** Called when the SignalingState changed. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection +- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection didChangeSignalingState:(RTCSignalingState)stateChanged; /** Called when media is received on a new stream from remote peer. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didAddStream:(RTCMediaStream *)stream; +- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection + didAddStream:(nonnull RTCMediaStream *)stream; /** Called when a remote peer closes a stream. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didRemoveStream:(RTCMediaStream *)stream; +- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection + didRemoveStream:(nonnull RTCMediaStream *)stream; /** Called when negotiation is needed, for example ICE has restarted. */ -- (void)peerConnectionShouldNegotiate:(RTCPeerConnection *)peerConnection; +- (void)peerConnectionShouldNegotiate: + (nonnull RTCPeerConnection *)peerConnection; /** Called any time the IceConnectionState changes. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection +- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection didChangeIceConnectionState:(RTCIceConnectionState)newState; /** Called any time the IceGatheringState changes. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection +- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection didChangeIceGatheringState:(RTCIceGatheringState)newState; /** New ice candidate has been found. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didGenerateIceCandidate:(RTCIceCandidate *)candidate; +- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection + didGenerateIceCandidate:(nonnull RTCIceCandidate *)candidate; /** New data channel has been opened. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didOpenDataChannel:(RTCDataChannel *)dataChannel; +- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection + didOpenDataChannel:(nonnull RTCDataChannel *)dataChannel; @end @@ -104,8 +106,8 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) { /** The object that will be notifed about events such as state changes and * streams being added or removed. */ -@property(nonatomic, weak) id delegate; -@property(nonatomic, readonly) NSArray *localStreams; +@property(nonatomic, weak, nullable) id delegate; +@property(nonatomic, readonly, nonnull) NSArray *localStreams; @property(nonatomic, readonly, nullable) RTCSessionDescription *localDescription; @property(nonatomic, readonly, nullable) @@ -114,54 +116,62 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) { @property(nonatomic, readonly) RTCIceConnectionState iceConnectionState; @property(nonatomic, readonly) RTCIceGatheringState iceGatheringState; -- (instancetype)init NS_UNAVAILABLE; +- (nonnull instancetype)init NS_UNAVAILABLE; /** Initialize an RTCPeerConnection with a configuration, constraints, and * delegate. */ -- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory - configuration:(RTCConfiguration *)configuration - constraints:(RTCMediaConstraints *)constraints - delegate:(id)delegate +- (nonnull instancetype)initWithFactory: + (nonnull RTCPeerConnectionFactory *)factory + configuration: + (nonnull RTCConfiguration *)configuration + constraints: + (nonnull RTCMediaConstraints *)constraints + delegate: + (nullable id)delegate NS_DESIGNATED_INITIALIZER; /** Terminate all media and close the transport. */ - (void)close; /** Provide a remote candidate to the ICE Agent. */ -- (void)addIceCandidate:(RTCIceCandidate *)candidate; +- (void)addIceCandidate:(nonnull RTCIceCandidate *)candidate; /** Add a new media stream to be sent on this peer connection. */ -- (void)addStream:(RTCMediaStream *)stream; +- (void)addStream:(nonnull RTCMediaStream *)stream; /** Remove the given media stream from this peer connection. */ -- (void)removeStream:(RTCMediaStream *)stream; +- (void)removeStream:(nonnull RTCMediaStream *)stream; /** Generate an SDP offer. */ -- (void)offerForConstraints:(RTCMediaConstraints *)constraints - completionHandler:(void (^)(RTCSessionDescription *sdp, - NSError *error))completionHandler; +- (void)offerForConstraints:(nonnull RTCMediaConstraints *)constraints + completionHandler:(nullable void (^) + (RTCSessionDescription * _Nullable sdp, + NSError * _Nullable error))completionHandler; /** Generate an SDP answer. */ -- (void)answerForConstraints:(RTCMediaConstraints *)constraints - completionHandler:(void (^)(RTCSessionDescription *sdp, - NSError *error))completionHandler; +- (void)answerForConstraints:(nonnull RTCMediaConstraints *)constraints + completionHandler:(nullable void (^) + (RTCSessionDescription * _Nullable sdp, + NSError * _Nullable error))completionHandler; /** Apply the supplied RTCSessionDescription as the local description. */ -- (void)setLocalDescription:(RTCSessionDescription *)sdp - completionHandler:(void (^)(NSError *error))completionHandler; +- (void)setLocalDescription:(nonnull RTCSessionDescription *)sdp + completionHandler: + (nullable void (^)(NSError * _Nullable error))completionHandler; /** Apply the supplied RTCSessionDescription as the remote description. */ -- (void)setRemoteDescription:(RTCSessionDescription *)sdp - completionHandler:(void (^)(NSError *error))completionHandler; +- (void)setRemoteDescription:(nonnull RTCSessionDescription *)sdp + completionHandler: + (nullable void (^)(NSError * _Nullable error))completionHandler; @end @interface RTCPeerConnection (DataChannel) /** Create a new data channel with the given label and configuration. */ -- (RTCDataChannel *)dataChannelForLabel:(NSString *)label - configuration:(RTCDataChannelConfiguration *)configuration; +- (nonnull RTCDataChannel *)dataChannelForLabel:(nonnull NSString *)label + configuration:(nonnull RTCDataChannelConfiguration *)configuration; @end @@ -171,10 +181,11 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) { * statistics are gathered for all tracks. */ - (void)statsForTrack: - (nullable RTCMediaStreamTrack *)mediaStreamTrack + (nonnull RTCMediaStreamTrack *)mediaStreamTrack statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel completionHandler: - (void (^)(NSArray *stats))completionHandler; + (nullable void (^)(NSArray * _Nonnull stats))completionHandler; + // (nullable void (^)(NSArray *stats))completionHandler; @end diff --git a/webrtc/api/objc/RTCStatsReport.h b/webrtc/api/objc/RTCStatsReport.h index fc66faf2cf..9a120b9072 100644 --- a/webrtc/api/objc/RTCStatsReport.h +++ b/webrtc/api/objc/RTCStatsReport.h @@ -11,6 +11,7 @@ #import NS_ASSUME_NONNULL_BEGIN +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 /** This does not currently conform to the spec. */ @interface RTCStatsReport : NSObject @@ -25,7 +26,8 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, readonly) NSString *statsId; /** A dictionary holding the actual stats. */ -@property(nonatomic, readonly) NSDictionary *values; +@property(nonatomic, readonly) NSDictionary *values; +// @property(nonatomic, readonly) NSDictionary *values; - (instancetype)init NS_UNAVAILABLE; diff --git a/webrtc/api/objc/RTCStatsReport.mm b/webrtc/api/objc/RTCStatsReport.mm index 35a5229014..76de95078c 100644 --- a/webrtc/api/objc/RTCStatsReport.mm +++ b/webrtc/api/objc/RTCStatsReport.mm @@ -16,6 +16,8 @@ #import "webrtc/base/objc/NSString+StdString.h" #import "webrtc/base/objc/RTCLogging.h" +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 + @implementation RTCStatsReport @synthesize timestamp = _timestamp; @@ -50,9 +52,8 @@ valuePair.second->ToString()]; // Not expecting duplicate keys. - RTC_DCHECK(values[key]); - - values[key] = value; + RTC_DCHECK(![values objectForKey:key]); + [values setObject:value forKey:key]; } _values = values; } diff --git a/webrtc/api/objc/RTCVideoFrame.h b/webrtc/api/objc/RTCVideoFrame.h index 8ed23ba82c..c71029051a 100644 --- a/webrtc/api/objc/RTCVideoFrame.h +++ b/webrtc/api/objc/RTCVideoFrame.h @@ -11,6 +11,7 @@ #import NS_ASSUME_NONNULL_BEGIN +// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592 @interface RTCVideoFrame : NSObject @@ -30,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, readonly) int32_t uPitch; @property(nonatomic, readonly) int32_t vPitch; -- (instancetype)init NS_UNAVAILABLE; +- (nonnull instancetype)init NS_UNAVAILABLE; @end diff --git a/webrtc/api/objc/WebRTC-Prefix.pch b/webrtc/api/objc/WebRTC-Prefix.pch deleted file mode 100644 index 990b1602da..0000000000 --- a/webrtc/api/objc/WebRTC-Prefix.pch +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2015 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. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif diff --git a/webrtc/api/objctests/RTCMediaConstraintsTest.mm b/webrtc/api/objctests/RTCMediaConstraintsTest.mm index 44ffe3d033..f73a6ca895 100644 --- a/webrtc/api/objctests/RTCMediaConstraintsTest.mm +++ b/webrtc/api/objctests/RTCMediaConstraintsTest.mm @@ -47,7 +47,7 @@ EXPECT_EQ(constraints.count, nativeConstraints.size()); for (NSString *key in constraints) { - NSString *value = constraints[key]; + NSString *value = [constraints objectForKey:key]; std::string nativeValue; bool found = nativeConstraints.FindFirst(key.stdString, &nativeValue);