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}
This commit is contained in:
Mirko Bonadei
2020-05-04 16:14:32 +02:00
committed by Commit Bot
parent ce1320cc4d
commit a81e9c82fc
303 changed files with 2534 additions and 2189 deletions

View File

@ -12,21 +12,21 @@
#import "RTCMacros.h"
@class RTCConfiguration;
@class RTCDataChannel;
@class RTCDataChannelConfiguration;
@class RTCIceCandidate;
@class RTCMediaConstraints;
@class RTCMediaStream;
@class RTCMediaStreamTrack;
@class RTCPeerConnectionFactory;
@class RTCRtpReceiver;
@class RTCRtpSender;
@class RTCRtpTransceiver;
@class RTCRtpTransceiverInit;
@class RTCSessionDescription;
@class RTC_OBJC_TYPE(RTCConfiguration);
@class RTC_OBJC_TYPE(RTCDataChannel);
@class RTC_OBJC_TYPE(RTCDataChannelConfiguration);
@class RTC_OBJC_TYPE(RTCIceCandidate);
@class RTC_OBJC_TYPE(RTCMediaConstraints);
@class RTC_OBJC_TYPE(RTCMediaStream);
@class RTC_OBJC_TYPE(RTCMediaStreamTrack);
@class RTC_OBJC_TYPE(RTCPeerConnectionFactory);
@class RTC_OBJC_TYPE(RTCRtpReceiver);
@class RTC_OBJC_TYPE(RTCRtpSender);
@class RTC_OBJC_TYPE(RTCRtpTransceiver);
@class RTC_OBJC_TYPE(RTCRtpTransceiverInit);
@class RTC_OBJC_TYPE(RTCSessionDescription);
@class RTCStatisticsReport;
@class RTCLegacyStatsReport;
@class RTC_OBJC_TYPE(RTCLegacyStatsReport);
typedef NS_ENUM(NSInteger, RTCRtpMediaType);
@ -81,45 +81,49 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
RTCStatsOutputLevelDebug,
};
@class RTCPeerConnection;
@class RTC_OBJC_TYPE(RTCPeerConnection);
RTC_OBJC_EXPORT
@protocol RTCPeerConnectionDelegate <NSObject>
@protocol RTC_OBJC_TYPE
(RTCPeerConnectionDelegate)<NSObject>
/** Called when the SignalingState changed. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didChangeSignalingState:(RTCSignalingState)stateChanged;
/** Called when the SignalingState changed. */
- (void)peerConnection
: (RTC_OBJC_TYPE(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:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didAddStream:(RTC_OBJC_TYPE(RTCMediaStream) *)stream;
/** Called when a remote peer closes a stream.
* This is not called when RTCSdpSemanticsUnifiedPlan is specified.
*/
- (void)peerConnection:(RTCPeerConnection *)peerConnection didRemoveStream:(RTCMediaStream *)stream;
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didRemoveStream:(RTC_OBJC_TYPE(RTCMediaStream) *)stream;
/** Called when negotiation is needed, for example ICE has restarted. */
- (void)peerConnectionShouldNegotiate:(RTCPeerConnection *)peerConnection;
- (void)peerConnectionShouldNegotiate:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection;
/** Called any time the IceConnectionState changes. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didChangeIceConnectionState:(RTCIceConnectionState)newState;
/** Called any time the IceGatheringState changes. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didChangeIceGatheringState:(RTCIceGatheringState)newState;
/** New ice candidate has been found. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didGenerateIceCandidate:(RTCIceCandidate *)candidate;
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didGenerateIceCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)candidate;
/** Called when a group of local Ice candidates have been removed. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didRemoveIceCandidates:(NSArray<RTCIceCandidate *> *)candidates;
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didRemoveIceCandidates:(NSArray<RTC_OBJC_TYPE(RTCIceCandidate) *> *)candidates;
/** New data channel has been opened. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didOpenDataChannel:(RTCDataChannel *)dataChannel;
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didOpenDataChannel:(RTC_OBJC_TYPE(RTCDataChannel) *)dataChannel;
/** Called when signaling indicates a transceiver will be receiving media from
* the remote endpoint.
@ -128,72 +132,72 @@ RTC_OBJC_EXPORT
@optional
/** Called any time the IceConnectionState changes following standardized
* transition. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didChangeStandardizedIceConnectionState:(RTCIceConnectionState)newState;
/** Called any time the PeerConnectionState changes. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didChangeConnectionState:(RTCPeerConnectionState)newState;
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didStartReceivingOnTransceiver:(RTCRtpTransceiver *)transceiver;
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didStartReceivingOnTransceiver:(RTC_OBJC_TYPE(RTCRtpTransceiver) *)transceiver;
/** Called when a receiver and its track are created. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didAddReceiver:(RTCRtpReceiver *)rtpReceiver
streams:(NSArray<RTCMediaStream *> *)mediaStreams;
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didAddReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)rtpReceiver
streams:(NSArray<RTC_OBJC_TYPE(RTCMediaStream) *> *)mediaStreams;
/** Called when the receiver and its track are removed. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didRemoveReceiver:(RTCRtpReceiver *)rtpReceiver;
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didRemoveReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)rtpReceiver;
/** Called when the selected ICE candidate pair is changed. */
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didChangeLocalCandidate:(RTCIceCandidate *)local
remoteCandidate:(RTCIceCandidate *)remote
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
didChangeLocalCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)local
remoteCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)remote
lastReceivedMs:(int)lastDataReceivedMs
changeReason:(NSString *)reason;
@end
RTC_OBJC_EXPORT
@interface RTCPeerConnection : NSObject
@interface RTC_OBJC_TYPE (RTCPeerConnection) : NSObject
/** The object that will be notifed about events such as state changes and
* streams being added or removed.
*/
@property(nonatomic, weak, nullable) id<RTCPeerConnectionDelegate> delegate;
@property(nonatomic, weak, nullable) id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)> delegate;
/** This property is not available with RTCSdpSemanticsUnifiedPlan. Please use
* |senders| instead.
*/
@property(nonatomic, readonly) NSArray<RTCMediaStream *> *localStreams;
@property(nonatomic, readonly, nullable) RTCSessionDescription *localDescription;
@property(nonatomic, readonly, nullable) RTCSessionDescription *remoteDescription;
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCMediaStream) *> *localStreams;
@property(nonatomic, readonly, nullable) RTC_OBJC_TYPE(RTCSessionDescription) * localDescription;
@property(nonatomic, readonly, nullable) RTC_OBJC_TYPE(RTCSessionDescription) * remoteDescription;
@property(nonatomic, readonly) RTCSignalingState signalingState;
@property(nonatomic, readonly) RTCIceConnectionState iceConnectionState;
@property(nonatomic, readonly) RTCPeerConnectionState connectionState;
@property(nonatomic, readonly) RTCIceGatheringState iceGatheringState;
@property(nonatomic, readonly, copy) RTCConfiguration *configuration;
@property(nonatomic, readonly, copy) RTC_OBJC_TYPE(RTCConfiguration) * configuration;
/** Gets all RTCRtpSenders associated with this peer connection.
* Note: reading this property returns different instances of RTCRtpSender.
* Use isEqual: instead of == to compare RTCRtpSender instances.
*/
@property(nonatomic, readonly) NSArray<RTCRtpSender *> *senders;
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCRtpSender) *> *senders;
/** Gets all RTCRtpReceivers associated with this peer connection.
* Note: reading this property returns different instances of RTCRtpReceiver.
* Use isEqual: instead of == to compare RTCRtpReceiver instances.
*/
@property(nonatomic, readonly) NSArray<RTCRtpReceiver *> *receivers;
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCRtpReceiver) *> *receivers;
/** Gets all RTCRtpTransceivers associated with this peer connection.
* Note: reading this property returns different instances of
* RTCRtpTransceiver. Use isEqual: instead of == to compare RTCRtpTransceiver
* instances.
* This is only available with RTCSdpSemanticsUnifiedPlan specified.
* RTCRtpTransceiver. Use isEqual: instead of == to compare
* RTCRtpTransceiver instances. This is only available with
* RTCSdpSemanticsUnifiedPlan specified.
*/
@property(nonatomic, readonly) NSArray<RTCRtpTransceiver *> *transceivers;
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCRtpTransceiver) *> *transceivers;
- (instancetype)init NS_UNAVAILABLE;
@ -203,38 +207,39 @@ RTC_OBJC_EXPORT
* new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies
* cannot be changed with this method.
*/
- (BOOL)setConfiguration:(RTCConfiguration *)configuration;
- (BOOL)setConfiguration:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration;
/** Terminate all media and close the transport. */
- (void)close;
/** Provide a remote candidate to the ICE Agent. */
- (void)addIceCandidate:(RTCIceCandidate *)candidate;
- (void)addIceCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)candidate;
/** Remove a group of remote candidates from the ICE Agent. */
- (void)removeIceCandidates:(NSArray<RTCIceCandidate *> *)candidates;
- (void)removeIceCandidates:(NSArray<RTC_OBJC_TYPE(RTCIceCandidate) *> *)candidates;
/** Add a new media stream to be sent on this peer connection.
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
* addTrack instead.
*/
- (void)addStream:(RTCMediaStream *)stream;
- (void)addStream:(RTC_OBJC_TYPE(RTCMediaStream) *)stream;
/** Remove the given media stream from this peer connection.
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
* removeTrack instead.
*/
- (void)removeStream:(RTCMediaStream *)stream;
- (void)removeStream:(RTC_OBJC_TYPE(RTCMediaStream) *)stream;
/** Add a new media stream track to be sent on this peer connection, and return
* the newly created RTCRtpSender. The RTCRtpSender will be associated with
* the streams specified in the |streamIds| list.
* the newly created RTCRtpSender. The RTCRtpSender will be
* associated with the streams specified in the |streamIds| list.
*
* Errors: If an error occurs, returns nil. An error can occur if:
* - A sender already exists for the track.
* - The peer connection is closed.
*/
- (RTCRtpSender *)addTrack:(RTCMediaStreamTrack *)track streamIds:(NSArray<NSString *> *)streamIds;
- (RTC_OBJC_TYPE(RTCRtpSender) *)addTrack:(RTC_OBJC_TYPE(RTCMediaStreamTrack) *)track
streamIds:(NSArray<NSString *> *)streamIds;
/** With PlanB semantics, removes an RTCRtpSender from this peer connection.
*
@ -243,7 +248,7 @@ RTC_OBJC_EXPORT
*
* Returns YES on success.
*/
- (BOOL)removeTrack:(RTCRtpSender *)sender;
- (BOOL)removeTrack:(RTC_OBJC_TYPE(RTCRtpSender) *)sender;
/** addTransceiver creates a new RTCRtpTransceiver and adds it to the set of
* transceivers. Adding a transceiver will cause future calls to CreateOffer
@ -266,33 +271,37 @@ RTC_OBJC_EXPORT
* of the transceiver (and sender/receiver) will be derived from the kind of
* the track.
*/
- (RTCRtpTransceiver *)addTransceiverWithTrack:(RTCMediaStreamTrack *)track;
- (RTCRtpTransceiver *)addTransceiverWithTrack:(RTCMediaStreamTrack *)track
init:(RTCRtpTransceiverInit *)init;
- (RTC_OBJC_TYPE(RTCRtpTransceiver) *)addTransceiverWithTrack:
(RTC_OBJC_TYPE(RTCMediaStreamTrack) *)track;
- (RTC_OBJC_TYPE(RTCRtpTransceiver) *)
addTransceiverWithTrack:(RTC_OBJC_TYPE(RTCMediaStreamTrack) *)track
init:(RTC_OBJC_TYPE(RTCRtpTransceiverInit) *)init;
/** Adds a transceiver with the given kind. Can either be RTCRtpMediaTypeAudio
* or RTCRtpMediaTypeVideo.
*/
- (RTCRtpTransceiver *)addTransceiverOfType:(RTCRtpMediaType)mediaType;
- (RTCRtpTransceiver *)addTransceiverOfType:(RTCRtpMediaType)mediaType
init:(RTCRtpTransceiverInit *)init;
- (RTC_OBJC_TYPE(RTCRtpTransceiver) *)addTransceiverOfType:(RTCRtpMediaType)mediaType;
- (RTC_OBJC_TYPE(RTCRtpTransceiver) *)addTransceiverOfType:(RTCRtpMediaType)mediaType
init:(RTC_OBJC_TYPE(RTCRtpTransceiverInit) *)
init;
/** Generate an SDP offer. */
- (void)offerForConstraints:(RTCMediaConstraints *)constraints
completionHandler:(nullable void (^)(RTCSessionDescription *_Nullable sdp,
- (void)offerForConstraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
completionHandler:(nullable void (^)(RTC_OBJC_TYPE(RTCSessionDescription) * _Nullable sdp,
NSError *_Nullable error))completionHandler;
/** Generate an SDP answer. */
- (void)answerForConstraints:(RTCMediaConstraints *)constraints
completionHandler:(nullable void (^)(RTCSessionDescription *_Nullable sdp,
NSError *_Nullable error))completionHandler;
- (void)answerForConstraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
completionHandler:
(nullable void (^)(RTC_OBJC_TYPE(RTCSessionDescription) * _Nullable sdp,
NSError *_Nullable error))completionHandler;
/** Apply the supplied RTCSessionDescription as the local description. */
- (void)setLocalDescription:(RTCSessionDescription *)sdp
- (void)setLocalDescription:(RTC_OBJC_TYPE(RTCSessionDescription) *)sdp
completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
/** Apply the supplied RTCSessionDescription as the remote description. */
- (void)setRemoteDescription:(RTCSessionDescription *)sdp
- (void)setRemoteDescription:(RTC_OBJC_TYPE(RTCSessionDescription) *)sdp
completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
/** Limits the bandwidth allocated for all RTP streams sent by this
@ -310,35 +319,40 @@ RTC_OBJC_EXPORT
@end
@interface RTCPeerConnection (Media)
@interface RTC_OBJC_TYPE (RTCPeerConnection)
(Media)
/** Create an RTCRtpSender with the specified kind and media stream ID.
* See RTCMediaStreamTrack.h for available kinds.
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
* addTransceiver instead.
*/
- (RTCRtpSender *)senderWithKind:(NSString *)kind streamId:(NSString *)streamId;
/** Create an RTCRtpSender with the specified kind and media stream ID.
* See RTCMediaStreamTrack.h for available kinds.
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
* addTransceiver instead.
*/
- (RTC_OBJC_TYPE(RTCRtpSender) *)senderWithKind : (NSString *)kind streamId
: (NSString *)streamId;
@end
@interface RTCPeerConnection (DataChannel)
@interface RTC_OBJC_TYPE (RTCPeerConnection)
(DataChannel)
/** Create a new data channel with the given label and configuration. */
- (nullable RTCDataChannel *)dataChannelForLabel:(NSString *)label
configuration:(RTCDataChannelConfiguration *)configuration;
/** Create a new data channel with the given label and configuration. */
- (nullable RTC_OBJC_TYPE(RTCDataChannel) *)dataChannelForLabel
: (NSString *)label configuration : (RTC_OBJC_TYPE(RTCDataChannelConfiguration) *)configuration;
@end
typedef void (^RTCStatisticsCompletionHandler)(RTCStatisticsReport *);
@interface RTCPeerConnection (Stats)
@interface RTC_OBJC_TYPE (RTCPeerConnection)
(Stats)
/** Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil
* statistics are gathered for all tracks.
*/
- (void)statsForTrack:(nullable RTCMediaStreamTrack *)mediaStreamTrack
statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel
completionHandler:(nullable void (^)(NSArray<RTCLegacyStatsReport *> *stats))completionHandler;
/** Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil
* statistics are gathered for all tracks.
*/
- (void)statsForTrack
: (nullable RTC_OBJC_TYPE(RTCMediaStreamTrack) *)mediaStreamTrack statsOutputLevel
: (RTCStatsOutputLevel)statsOutputLevel completionHandler
: (nullable void (^)(NSArray<RTC_OBJC_TYPE(RTCLegacyStatsReport) *> *stats))completionHandler;
/** Gather statistic through the v2 statistics API. */
- (void)statisticsWithCompletionHandler:(RTCStatisticsCompletionHandler)completionHandler;
@ -346,13 +360,13 @@ typedef void (^RTCStatisticsCompletionHandler)(RTCStatisticsReport *);
/** Spec-compliant getStats() performing the stats selection algorithm with the
* sender.
*/
- (void)statisticsForSender:(RTCRtpSender *)sender
- (void)statisticsForSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender
completionHandler:(RTCStatisticsCompletionHandler)completionHandler;
/** Spec-compliant getStats() performing the stats selection algorithm with the
* receiver.
*/
- (void)statisticsForReceiver:(RTCRtpReceiver *)receiver
- (void)statisticsForReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver
completionHandler:(RTCStatisticsCompletionHandler)completionHandler;
@end