1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright 2018 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker #import <Foundation/Foundation.h> 12*d9f75844SAndroid Build Coastguard Worker 13*d9f75844SAndroid Build Coastguard Worker #import "RTCMacros.h" 14*d9f75844SAndroid Build Coastguard Worker #import "RTCRtpReceiver.h" 15*d9f75844SAndroid Build Coastguard Worker #import "RTCRtpSender.h" 16*d9f75844SAndroid Build Coastguard Worker 17*d9f75844SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_BEGIN 18*d9f75844SAndroid Build Coastguard Worker 19*d9f75844SAndroid Build Coastguard Worker extern NSString *const kRTCRtpTransceiverErrorDomain; 20*d9f75844SAndroid Build Coastguard Worker 21*d9f75844SAndroid Build Coastguard Worker /** https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverdirection */ 22*d9f75844SAndroid Build Coastguard Worker typedef NS_ENUM(NSInteger, RTCRtpTransceiverDirection) { 23*d9f75844SAndroid Build Coastguard Worker RTCRtpTransceiverDirectionSendRecv, 24*d9f75844SAndroid Build Coastguard Worker RTCRtpTransceiverDirectionSendOnly, 25*d9f75844SAndroid Build Coastguard Worker RTCRtpTransceiverDirectionRecvOnly, 26*d9f75844SAndroid Build Coastguard Worker RTCRtpTransceiverDirectionInactive, 27*d9f75844SAndroid Build Coastguard Worker RTCRtpTransceiverDirectionStopped 28*d9f75844SAndroid Build Coastguard Worker }; 29*d9f75844SAndroid Build Coastguard Worker 30*d9f75844SAndroid Build Coastguard Worker /** Structure for initializing an RTCRtpTransceiver in a call to 31*d9f75844SAndroid Build Coastguard Worker * RTCPeerConnection.addTransceiver. 32*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit 33*d9f75844SAndroid Build Coastguard Worker */ 34*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_EXPORT 35*d9f75844SAndroid Build Coastguard Worker @interface RTC_OBJC_TYPE (RTCRtpTransceiverInit) : NSObject 36*d9f75844SAndroid Build Coastguard Worker 37*d9f75844SAndroid Build Coastguard Worker /** Direction of the RTCRtpTransceiver. See RTCRtpTransceiver.direction. */ 38*d9f75844SAndroid Build Coastguard Worker @property(nonatomic) RTCRtpTransceiverDirection direction; 39*d9f75844SAndroid Build Coastguard Worker 40*d9f75844SAndroid Build Coastguard Worker /** The added RTCRtpTransceiver will be added to these streams. */ 41*d9f75844SAndroid Build Coastguard Worker @property(nonatomic) NSArray<NSString *> *streamIds; 42*d9f75844SAndroid Build Coastguard Worker 43*d9f75844SAndroid Build Coastguard Worker /** TODO(bugs.webrtc.org/7600): Not implemented. */ 44*d9f75844SAndroid Build Coastguard Worker @property(nonatomic) NSArray<RTC_OBJC_TYPE(RTCRtpEncodingParameters) *> *sendEncodings; 45*d9f75844SAndroid Build Coastguard Worker 46*d9f75844SAndroid Build Coastguard Worker @end 47*d9f75844SAndroid Build Coastguard Worker 48*d9f75844SAndroid Build Coastguard Worker @class RTC_OBJC_TYPE(RTCRtpTransceiver); 49*d9f75844SAndroid Build Coastguard Worker 50*d9f75844SAndroid Build Coastguard Worker /** The RTCRtpTransceiver maps to the RTCRtpTransceiver defined by the 51*d9f75844SAndroid Build Coastguard Worker * WebRTC specification. A transceiver represents a combination of an RTCRtpSender 52*d9f75844SAndroid Build Coastguard Worker * and an RTCRtpReceiver that share a common mid. As defined in JSEP, an 53*d9f75844SAndroid Build Coastguard Worker * RTCRtpTransceiver is said to be associated with a media description if its 54*d9f75844SAndroid Build Coastguard Worker * mid property is non-nil; otherwise, it is said to be disassociated. 55*d9f75844SAndroid Build Coastguard Worker * JSEP: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24 56*d9f75844SAndroid Build Coastguard Worker * 57*d9f75844SAndroid Build Coastguard Worker * Note that RTCRtpTransceivers are only supported when using 58*d9f75844SAndroid Build Coastguard Worker * RTCPeerConnection with Unified Plan SDP. 59*d9f75844SAndroid Build Coastguard Worker * 60*d9f75844SAndroid Build Coastguard Worker * WebRTC specification for RTCRtpTransceiver, the JavaScript analog: 61*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver 62*d9f75844SAndroid Build Coastguard Worker */ 63*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_EXPORT 64*d9f75844SAndroid Build Coastguard Worker @protocol RTC_OBJC_TYPE 65*d9f75844SAndroid Build Coastguard Worker (RTCRtpTransceiver)<NSObject> 66*d9f75844SAndroid Build Coastguard Worker 67*d9f75844SAndroid Build Coastguard Worker /** Media type of the transceiver. The sender and receiver will also have this 68*d9f75844SAndroid Build Coastguard Worker * type. 69*d9f75844SAndroid Build Coastguard Worker */ 70*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, readonly) RTCRtpMediaType mediaType; 71*d9f75844SAndroid Build Coastguard Worker 72*d9f75844SAndroid Build Coastguard Worker /** The mid attribute is the mid negotiated and present in the local and 73*d9f75844SAndroid Build Coastguard Worker * remote descriptions. Before negotiation is complete, the mid value may be 74*d9f75844SAndroid Build Coastguard Worker * nil. After rollbacks, the value may change from a non-nil value to nil. 75*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid 76*d9f75844SAndroid Build Coastguard Worker */ 77*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSString *mid; 78*d9f75844SAndroid Build Coastguard Worker 79*d9f75844SAndroid Build Coastguard Worker /** The sender attribute exposes the RTCRtpSender corresponding to the RTP 80*d9f75844SAndroid Build Coastguard Worker * media that may be sent with the transceiver's mid. The sender is always 81*d9f75844SAndroid Build Coastguard Worker * present, regardless of the direction of media. 82*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender 83*d9f75844SAndroid Build Coastguard Worker */ 84*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, readonly) RTC_OBJC_TYPE(RTCRtpSender) * sender; 85*d9f75844SAndroid Build Coastguard Worker 86*d9f75844SAndroid Build Coastguard Worker /** The receiver attribute exposes the RTCRtpReceiver corresponding to the RTP 87*d9f75844SAndroid Build Coastguard Worker * media that may be received with the transceiver's mid. The receiver is 88*d9f75844SAndroid Build Coastguard Worker * always present, regardless of the direction of media. 89*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver 90*d9f75844SAndroid Build Coastguard Worker */ 91*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, readonly) RTC_OBJC_TYPE(RTCRtpReceiver) * receiver; 92*d9f75844SAndroid Build Coastguard Worker 93*d9f75844SAndroid Build Coastguard Worker /** The isStopped attribute indicates that the sender of this transceiver will 94*d9f75844SAndroid Build Coastguard Worker * no longer send, and that the receiver will no longer receive. It is true if 95*d9f75844SAndroid Build Coastguard Worker * either stop has been called or if setting the local or remote description 96*d9f75844SAndroid Build Coastguard Worker * has caused the RTCRtpTransceiver to be stopped. 97*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped 98*d9f75844SAndroid Build Coastguard Worker */ 99*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, readonly) BOOL isStopped; 100*d9f75844SAndroid Build Coastguard Worker 101*d9f75844SAndroid Build Coastguard Worker /** The direction attribute indicates the preferred direction of this 102*d9f75844SAndroid Build Coastguard Worker * transceiver, which will be used in calls to createOffer and createAnswer. 103*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction 104*d9f75844SAndroid Build Coastguard Worker */ 105*d9f75844SAndroid Build Coastguard Worker @property(nonatomic, readonly) RTCRtpTransceiverDirection direction; 106*d9f75844SAndroid Build Coastguard Worker 107*d9f75844SAndroid Build Coastguard Worker /** The currentDirection attribute indicates the current direction negotiated 108*d9f75844SAndroid Build Coastguard Worker * for this transceiver. If this transceiver has never been represented in an 109*d9f75844SAndroid Build Coastguard Worker * offer/answer exchange, or if the transceiver is stopped, the value is not 110*d9f75844SAndroid Build Coastguard Worker * present and this method returns NO. 111*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection 112*d9f75844SAndroid Build Coastguard Worker */ 113*d9f75844SAndroid Build Coastguard Worker - (BOOL)currentDirection:(RTCRtpTransceiverDirection *)currentDirectionOut; 114*d9f75844SAndroid Build Coastguard Worker 115*d9f75844SAndroid Build Coastguard Worker /** The stop method irreversibly stops the RTCRtpTransceiver. The sender of 116*d9f75844SAndroid Build Coastguard Worker * this transceiver will no longer send, the receiver will no longer receive. 117*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop 118*d9f75844SAndroid Build Coastguard Worker */ 119*d9f75844SAndroid Build Coastguard Worker - (void)stopInternal; 120*d9f75844SAndroid Build Coastguard Worker 121*d9f75844SAndroid Build Coastguard Worker /** An update of directionality does not take effect immediately. Instead, 122*d9f75844SAndroid Build Coastguard Worker * future calls to createOffer and createAnswer mark the corresponding media 123*d9f75844SAndroid Build Coastguard Worker * descriptions as sendrecv, sendonly, recvonly, or inactive. 124*d9f75844SAndroid Build Coastguard Worker * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction 125*d9f75844SAndroid Build Coastguard Worker */ 126*d9f75844SAndroid Build Coastguard Worker - (void)setDirection:(RTCRtpTransceiverDirection)direction error:(NSError **)error; 127*d9f75844SAndroid Build Coastguard Worker 128*d9f75844SAndroid Build Coastguard Worker @end 129*d9f75844SAndroid Build Coastguard Worker 130*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_EXPORT 131*d9f75844SAndroid Build Coastguard Worker @interface RTC_OBJC_TYPE (RTCRtpTransceiver) : NSObject <RTC_OBJC_TYPE(RTCRtpTransceiver)> 132*d9f75844SAndroid Build Coastguard Worker 133*d9f75844SAndroid Build Coastguard Worker - (instancetype)init NS_UNAVAILABLE; 134*d9f75844SAndroid Build Coastguard Worker 135*d9f75844SAndroid Build Coastguard Worker @end 136*d9f75844SAndroid Build Coastguard Worker 137*d9f75844SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_END 138