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