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