2019-09-27 19:16:03 +00:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
#import "RTCMacros.h"
|
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
@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 RTC_OBJC_TYPE(RTCStatisticsReport);
|
|
|
|
@class RTC_OBJC_TYPE(RTCLegacyStatsReport);
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RTCRtpMediaType);
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
extern NSString *const kRTCPeerConnectionErrorDomain;
|
|
|
|
extern int const kRTCSessionDescriptionErrorCode;
|
|
|
|
|
|
|
|
/** Represents the signaling state of the peer connection. */
|
|
|
|
typedef NS_ENUM(NSInteger, RTCSignalingState) {
|
|
|
|
RTCSignalingStateStable,
|
|
|
|
RTCSignalingStateHaveLocalOffer,
|
|
|
|
RTCSignalingStateHaveLocalPrAnswer,
|
|
|
|
RTCSignalingStateHaveRemoteOffer,
|
|
|
|
RTCSignalingStateHaveRemotePrAnswer,
|
|
|
|
// Not an actual state, represents the total number of states.
|
|
|
|
RTCSignalingStateClosed,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Represents the ice connection state of the peer connection. */
|
|
|
|
typedef NS_ENUM(NSInteger, RTCIceConnectionState) {
|
|
|
|
RTCIceConnectionStateNew,
|
|
|
|
RTCIceConnectionStateChecking,
|
|
|
|
RTCIceConnectionStateConnected,
|
|
|
|
RTCIceConnectionStateCompleted,
|
|
|
|
RTCIceConnectionStateFailed,
|
|
|
|
RTCIceConnectionStateDisconnected,
|
|
|
|
RTCIceConnectionStateClosed,
|
|
|
|
RTCIceConnectionStateCount,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Represents the combined ice+dtls connection state of the peer connection. */
|
|
|
|
typedef NS_ENUM(NSInteger, RTCPeerConnectionState) {
|
|
|
|
RTCPeerConnectionStateNew,
|
|
|
|
RTCPeerConnectionStateConnecting,
|
|
|
|
RTCPeerConnectionStateConnected,
|
|
|
|
RTCPeerConnectionStateDisconnected,
|
|
|
|
RTCPeerConnectionStateFailed,
|
|
|
|
RTCPeerConnectionStateClosed,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Represents the ice gathering state of the peer connection. */
|
|
|
|
typedef NS_ENUM(NSInteger, RTCIceGatheringState) {
|
|
|
|
RTCIceGatheringStateNew,
|
|
|
|
RTCIceGatheringStateGathering,
|
|
|
|
RTCIceGatheringStateComplete,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Represents the stats output level. */
|
|
|
|
typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
|
|
|
|
RTCStatsOutputLevelStandard,
|
|
|
|
RTCStatsOutputLevelDebug,
|
|
|
|
};
|
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
@class RTC_OBJC_TYPE(RTCPeerConnection);
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
RTC_OBJC_EXPORT
|
2020-11-03 14:18:15 +00:00
|
|
|
@protocol RTC_OBJC_TYPE
|
|
|
|
(RTCPeerConnectionDelegate)<NSObject>
|
2019-09-27 19:16:03 +00:00
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
/** Called when the SignalingState changed. */
|
|
|
|
- (void)peerConnection
|
|
|
|
: (RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection didChangeSignalingState
|
|
|
|
: (RTCSignalingState)stateChanged;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Called when media is received on a new stream from remote peer. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didAddStream:(RTC_OBJC_TYPE(RTCMediaStream) *)stream;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Called when a remote peer closes a stream.
|
|
|
|
* This is not called when RTCSdpSemanticsUnifiedPlan is specified.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didRemoveStream:(RTC_OBJC_TYPE(RTCMediaStream) *)stream;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Called when negotiation is needed, for example ICE has restarted. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnectionShouldNegotiate:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Called any time the IceConnectionState changes. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
2019-09-27 19:16:03 +00:00
|
|
|
didChangeIceConnectionState:(RTCIceConnectionState)newState;
|
|
|
|
|
|
|
|
/** Called any time the IceGatheringState changes. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
2019-09-27 19:16:03 +00:00
|
|
|
didChangeIceGatheringState:(RTCIceGatheringState)newState;
|
|
|
|
|
|
|
|
/** New ice candidate has been found. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didGenerateIceCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)candidate;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Called when a group of local Ice candidates have been removed. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didRemoveIceCandidates:(NSArray<RTC_OBJC_TYPE(RTCIceCandidate) *> *)candidates;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** New data channel has been opened. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didOpenDataChannel:(RTC_OBJC_TYPE(RTCDataChannel) *)dataChannel;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Called when signaling indicates a transceiver will be receiving media from
|
|
|
|
* the remote endpoint.
|
|
|
|
* This is only called with RTCSdpSemanticsUnifiedPlan specified.
|
|
|
|
*/
|
|
|
|
@optional
|
2020-11-03 14:18:15 +00:00
|
|
|
/** Called any time the IceConnectionState changes following standardized
|
|
|
|
* transition. */
|
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didChangeStandardizedIceConnectionState:(RTCIceConnectionState)newState;
|
|
|
|
|
2019-09-27 19:16:03 +00:00
|
|
|
/** Called any time the PeerConnectionState changes. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
2019-09-27 19:16:03 +00:00
|
|
|
didChangeConnectionState:(RTCPeerConnectionState)newState;
|
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didStartReceivingOnTransceiver:(RTC_OBJC_TYPE(RTCRtpTransceiver) *)transceiver;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Called when a receiver and its track are created. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didAddReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)rtpReceiver
|
|
|
|
streams:(NSArray<RTC_OBJC_TYPE(RTCMediaStream) *> *)mediaStreams;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Called when the receiver and its track are removed. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
|
|
|
|
didRemoveReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)rtpReceiver;
|
|
|
|
|
|
|
|
/** Called when the selected ICE candidate pair is changed. */
|
|
|
|
- (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;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
RTC_OBJC_EXPORT
|
2020-11-03 14:18:15 +00:00
|
|
|
@interface RTC_OBJC_TYPE (RTCPeerConnection) : NSObject
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** The object that will be notifed about events such as state changes and
|
|
|
|
* streams being added or removed.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
@property(nonatomic, weak, nullable) id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)> delegate;
|
2019-09-27 19:16:03 +00:00
|
|
|
/** This property is not available with RTCSdpSemanticsUnifiedPlan. Please use
|
|
|
|
* |senders| instead.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
@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;
|
2019-09-27 19:16:03 +00:00
|
|
|
@property(nonatomic, readonly) RTCSignalingState signalingState;
|
|
|
|
@property(nonatomic, readonly) RTCIceConnectionState iceConnectionState;
|
|
|
|
@property(nonatomic, readonly) RTCPeerConnectionState connectionState;
|
|
|
|
@property(nonatomic, readonly) RTCIceGatheringState iceGatheringState;
|
2020-11-03 14:18:15 +00:00
|
|
|
@property(nonatomic, readonly, copy) RTC_OBJC_TYPE(RTCConfiguration) * configuration;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCRtpSender) *> *senders;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCRtpReceiver) *> *receivers;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Gets all RTCRtpTransceivers associated with this peer connection.
|
|
|
|
* Note: reading this property returns different instances of
|
2020-11-03 14:18:15 +00:00
|
|
|
* RTCRtpTransceiver. Use isEqual: instead of == to compare
|
|
|
|
* RTCRtpTransceiver instances. This is only available with
|
|
|
|
* RTCSdpSemanticsUnifiedPlan specified.
|
2019-09-27 19:16:03 +00:00
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCRtpTransceiver) *> *transceivers;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
|
|
|
|
/** Sets the PeerConnection's global configuration to |configuration|.
|
|
|
|
* Any changes to STUN/TURN servers or ICE candidate policy will affect the
|
|
|
|
* next gathering phase, and cause the next call to createOffer to generate
|
|
|
|
* new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies
|
|
|
|
* cannot be changed with this method.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (BOOL)setConfiguration:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Terminate all media and close the transport. */
|
|
|
|
- (void)close;
|
|
|
|
|
|
|
|
/** Provide a remote candidate to the ICE Agent. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)addIceCandidate:(RTC_OBJC_TYPE(RTCIceCandidate) *)candidate;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Remove a group of remote candidates from the ICE Agent. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)removeIceCandidates:(NSArray<RTC_OBJC_TYPE(RTCIceCandidate) *> *)candidates;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Add a new media stream to be sent on this peer connection.
|
|
|
|
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
|
|
|
|
* addTrack instead.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)addStream:(RTC_OBJC_TYPE(RTCMediaStream) *)stream;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Remove the given media stream from this peer connection.
|
|
|
|
* This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use
|
|
|
|
* removeTrack instead.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)removeStream:(RTC_OBJC_TYPE(RTCMediaStream) *)stream;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Add a new media stream track to be sent on this peer connection, and return
|
2020-11-03 14:18:15 +00:00
|
|
|
* the newly created RTCRtpSender. The RTCRtpSender will be
|
|
|
|
* associated with the streams specified in the |streamIds| list.
|
2019-09-27 19:16:03 +00:00
|
|
|
*
|
|
|
|
* Errors: If an error occurs, returns nil. An error can occur if:
|
|
|
|
* - A sender already exists for the track.
|
|
|
|
* - The peer connection is closed.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (RTC_OBJC_TYPE(RTCRtpSender) *)addTrack:(RTC_OBJC_TYPE(RTCMediaStreamTrack) *)track
|
|
|
|
streamIds:(NSArray<NSString *> *)streamIds;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** With PlanB semantics, removes an RTCRtpSender from this peer connection.
|
|
|
|
*
|
|
|
|
* With UnifiedPlan semantics, sets sender's track to null and removes the
|
|
|
|
* send component from the associated RTCRtpTransceiver's direction.
|
|
|
|
*
|
|
|
|
* Returns YES on success.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (BOOL)removeTrack:(RTC_OBJC_TYPE(RTCRtpSender) *)sender;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** addTransceiver creates a new RTCRtpTransceiver and adds it to the set of
|
|
|
|
* transceivers. Adding a transceiver will cause future calls to CreateOffer
|
|
|
|
* to add a media description for the corresponding transceiver.
|
|
|
|
*
|
|
|
|
* The initial value of |mid| in the returned transceiver is nil. Setting a
|
|
|
|
* new session description may change it to a non-nil value.
|
|
|
|
*
|
|
|
|
* https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver
|
|
|
|
*
|
|
|
|
* Optionally, an RtpTransceiverInit structure can be specified to configure
|
|
|
|
* the transceiver from construction. If not specified, the transceiver will
|
|
|
|
* default to having a direction of kSendRecv and not be part of any streams.
|
|
|
|
*
|
|
|
|
* These methods are only available when Unified Plan is enabled (see
|
|
|
|
* RTCConfiguration).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Adds a transceiver with a sender set to transmit the given track. The kind
|
|
|
|
* of the transceiver (and sender/receiver) will be derived from the kind of
|
|
|
|
* the track.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (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;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Adds a transceiver with the given kind. Can either be RTCRtpMediaTypeAudio
|
|
|
|
* or RTCRtpMediaTypeVideo.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (RTC_OBJC_TYPE(RTCRtpTransceiver) *)addTransceiverOfType:(RTCRtpMediaType)mediaType;
|
|
|
|
- (RTC_OBJC_TYPE(RTCRtpTransceiver) *)addTransceiverOfType:(RTCRtpMediaType)mediaType
|
|
|
|
init:(RTC_OBJC_TYPE(RTCRtpTransceiverInit) *)
|
|
|
|
init;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Generate an SDP offer. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)offerForConstraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
|
|
|
|
completionHandler:(nullable void (^)(RTC_OBJC_TYPE(RTCSessionDescription) * _Nullable sdp,
|
2019-09-27 19:16:03 +00:00
|
|
|
NSError *_Nullable error))completionHandler;
|
|
|
|
|
|
|
|
/** Generate an SDP answer. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)answerForConstraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
|
|
|
|
completionHandler:
|
|
|
|
(nullable void (^)(RTC_OBJC_TYPE(RTCSessionDescription) * _Nullable sdp,
|
|
|
|
NSError *_Nullable error))completionHandler;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Apply the supplied RTCSessionDescription as the local description. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)setLocalDescription:(RTC_OBJC_TYPE(RTCSessionDescription) *)sdp
|
2019-09-27 19:16:03 +00:00
|
|
|
completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
|
|
|
|
|
|
|
|
/** Apply the supplied RTCSessionDescription as the remote description. */
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)setRemoteDescription:(RTC_OBJC_TYPE(RTCSessionDescription) *)sdp
|
2019-09-27 19:16:03 +00:00
|
|
|
completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
|
|
|
|
|
|
|
|
/** Limits the bandwidth allocated for all RTP streams sent by this
|
|
|
|
* PeerConnection. Nil parameters will be unchanged. Setting
|
|
|
|
* |currentBitrateBps| will force the available bitrate estimate to the given
|
|
|
|
* value. Returns YES if the parameters were successfully updated.
|
|
|
|
*/
|
|
|
|
- (BOOL)setBweMinBitrateBps:(nullable NSNumber *)minBitrateBps
|
|
|
|
currentBitrateBps:(nullable NSNumber *)currentBitrateBps
|
|
|
|
maxBitrateBps:(nullable NSNumber *)maxBitrateBps;
|
|
|
|
|
|
|
|
/** Start or stop recording an Rtc EventLog. */
|
|
|
|
- (BOOL)startRtcEventLogWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes;
|
|
|
|
- (void)stopRtcEventLog;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
@interface RTC_OBJC_TYPE (RTCPeerConnection)
|
|
|
|
(Media)
|
2019-09-27 19:16:03 +00:00
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
/** 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;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
@interface RTC_OBJC_TYPE (RTCPeerConnection)
|
|
|
|
(DataChannel)
|
2019-09-27 19:16:03 +00:00
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
/** 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;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
typedef void (^RTCStatisticsCompletionHandler)(RTC_OBJC_TYPE(RTCStatisticsReport) *);
|
2019-09-27 19:16:03 +00:00
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
@interface RTC_OBJC_TYPE (RTCPeerConnection)
|
|
|
|
(Stats)
|
2019-09-27 19:16:03 +00:00
|
|
|
|
2020-11-03 14:18:15 +00:00
|
|
|
/** 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;
|
2019-09-27 19:16:03 +00:00
|
|
|
|
|
|
|
/** Gather statistic through the v2 statistics API. */
|
|
|
|
- (void)statisticsWithCompletionHandler:(RTCStatisticsCompletionHandler)completionHandler;
|
|
|
|
|
|
|
|
/** Spec-compliant getStats() performing the stats selection algorithm with the
|
|
|
|
* sender.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)statisticsForSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender
|
2019-09-27 19:16:03 +00:00
|
|
|
completionHandler:(RTCStatisticsCompletionHandler)completionHandler;
|
|
|
|
|
|
|
|
/** Spec-compliant getStats() performing the stats selection algorithm with the
|
|
|
|
* receiver.
|
|
|
|
*/
|
2020-11-03 14:18:15 +00:00
|
|
|
- (void)statisticsForReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver
|
2019-09-27 19:16:03 +00:00
|
|
|
completionHandler:(RTCStatisticsCompletionHandler)completionHandler;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|