blob: 8ef3fc1d42e7a30178608e3641ae98dec7ba7f96 [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,
25};
26
27/** Structure for initializing an RTCRtpTransceiver in a call to
28 * RTCPeerConnection.addTransceiver.
29 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
30 */
Piasye6caa9f2018-10-15 20:48:01 +080031RTC_OBJC_EXPORT
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020032@interface RTCRtpTransceiverInit : NSObject
33
34/** Direction of the RTCRtpTransceiver. See RTCRtpTransceiver.direction. */
35@property(nonatomic) RTCRtpTransceiverDirection direction;
36
37/** The added RTCRtpTransceiver will be added to these streams. */
38@property(nonatomic) NSArray<NSString *> *streamIds;
39
40/** TODO(bugs.webrtc.org/7600): Not implemented. */
41@property(nonatomic) NSArray<RTCRtpEncodingParameters *> *sendEncodings;
42
43@end
44
45@class RTCRtpTransceiver;
46
47/** The RTCRtpTransceiver maps to the RTCRtpTransceiver defined by the WebRTC
48 * specification. A transceiver represents a combination of an RTCRtpSender
49 * and an RTCRtpReceiver that share a common mid. As defined in JSEP, an
50 * RTCRtpTransceiver is said to be associated with a media description if its
51 * mid property is non-nil; otherwise, it is said to be disassociated.
52 * JSEP: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24
53 *
54 * Note that RTCRtpTransceivers are only supported when using
55 * RTCPeerConnection with Unified Plan SDP.
56 *
57 * WebRTC specification for RTCRtpTransceiver, the JavaScript analog:
58 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver
59 */
Mirko Bonadeie8d57242018-09-17 10:22:56 +020060RTC_OBJC_EXPORT
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020061@protocol RTCRtpTransceiver <NSObject>
62
63/** Media type of the transceiver. The sender and receiver will also have this
64 * type.
65 */
66@property(nonatomic, readonly) RTCRtpMediaType mediaType;
67
68/** The mid attribute is the mid negotiated and present in the local and
69 * remote descriptions. Before negotiation is complete, the mid value may be
70 * nil. After rollbacks, the value may change from a non-nil value to nil.
71 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
72 */
73@property(nonatomic, readonly) NSString *mid;
74
75/** The sender attribute exposes the RTCRtpSender corresponding to the RTP
76 * media that may be sent with the transceiver's mid. The sender is always
77 * present, regardless of the direction of media.
78 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender
79 */
80@property(nonatomic, readonly) RTCRtpSender *sender;
81
82/** The receiver attribute exposes the RTCRtpReceiver corresponding to the RTP
83 * media that may be received with the transceiver's mid. The receiver is
84 * always present, regardless of the direction of media.
85 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver
86 */
87@property(nonatomic, readonly) RTCRtpReceiver *receiver;
88
89/** The isStopped attribute indicates that the sender of this transceiver will
90 * no longer send, and that the receiver will no longer receive. It is true if
91 * either stop has been called or if setting the local or remote description
92 * has caused the RTCRtpTransceiver to be stopped.
93 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped
94 */
95@property(nonatomic, readonly) BOOL isStopped;
96
97/** The direction attribute indicates the preferred direction of this
98 * transceiver, which will be used in calls to createOffer and createAnswer.
99 * An update of directionality does not take effect immediately. Instead,
100 * future calls to createOffer and createAnswer mark the corresponding media
101 * descriptions as sendrecv, sendonly, recvonly, or inactive.
102 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
103 */
104@property(nonatomic) RTCRtpTransceiverDirection direction;
105
106/** The currentDirection attribute indicates the current direction negotiated
107 * for this transceiver. If this transceiver has never been represented in an
108 * offer/answer exchange, or if the transceiver is stopped, the value is not
109 * present and this method returns NO.
110 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
111 */
112- (BOOL)currentDirection:(RTCRtpTransceiverDirection *)currentDirectionOut;
113
114/** The stop method irreversibly stops the RTCRtpTransceiver. The sender of
115 * this transceiver will no longer send, the receiver will no longer receive.
116 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
117 */
118- (void)stop;
119
120@end
121
Mirko Bonadeie8d57242018-09-17 10:22:56 +0200122RTC_OBJC_EXPORT
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200123@interface RTCRtpTransceiver : NSObject <RTCRtpTransceiver>
124
125- (instancetype)init NS_UNAVAILABLE;
126
127@end
128
129NS_ASSUME_NONNULL_END