blob: 17054f5e437a1c4431cdc532870c9a661cfb68ca [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
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020033@interface RTC_OBJC_TYPE (RTCRtpTransceiverInit) : NSObject
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020034
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. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020042@property(nonatomic) NSArray<RTC_OBJC_TYPE(RTCRtpEncodingParameters) *> *sendEncodings;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020043
44@end
45
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020046@class RTC_OBJC_TYPE(RTCRtpTransceiver);
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020047
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020048/** The RTCRtpTransceiver maps to the RTCRtpTransceiver defined by the
49 * WebRTC specification. A transceiver represents a combination of an RTCRtpSender
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020050 * 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
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020062@protocol RTC_OBJC_TYPE
63(RTCRtpTransceiver)<NSObject>
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020064
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020065 /** Media type of the transceiver. The sender and receiver will also have this
66 * type.
67 */
68 @property(nonatomic, readonly) RTCRtpMediaType mediaType;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020069
70/** The mid attribute is the mid negotiated and present in the local and
71 * remote descriptions. Before negotiation is complete, the mid value may be
72 * nil. After rollbacks, the value may change from a non-nil value to nil.
73 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
74 */
75@property(nonatomic, readonly) NSString *mid;
76
77/** The sender attribute exposes the RTCRtpSender corresponding to the RTP
78 * media that may be sent with the transceiver's mid. The sender is always
79 * present, regardless of the direction of media.
80 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender
81 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020082@property(nonatomic, readonly) RTC_OBJC_TYPE(RTCRtpSender) * sender;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020083
84/** The receiver attribute exposes the RTCRtpReceiver corresponding to the RTP
85 * media that may be received with the transceiver's mid. The receiver is
86 * always present, regardless of the direction of media.
87 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver
88 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020089@property(nonatomic, readonly) RTC_OBJC_TYPE(RTCRtpReceiver) * receiver;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020090
91/** The isStopped attribute indicates that the sender of this transceiver will
92 * no longer send, and that the receiver will no longer receive. It is true if
93 * either stop has been called or if setting the local or remote description
94 * has caused the RTCRtpTransceiver to be stopped.
95 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped
96 */
97@property(nonatomic, readonly) BOOL isStopped;
98
99/** The direction attribute indicates the preferred direction of this
100 * transceiver, which will be used in calls to createOffer and createAnswer.
101 * An update of directionality does not take effect immediately. Instead,
102 * future calls to createOffer and createAnswer mark the corresponding media
103 * descriptions as sendrecv, sendonly, recvonly, or inactive.
104 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
105 */
106@property(nonatomic) RTCRtpTransceiverDirection direction;
107
108/** The currentDirection attribute indicates the current direction negotiated
109 * for this transceiver. If this transceiver has never been represented in an
110 * offer/answer exchange, or if the transceiver is stopped, the value is not
111 * present and this method returns NO.
112 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
113 */
114- (BOOL)currentDirection:(RTCRtpTransceiverDirection *)currentDirectionOut;
115
116/** The stop method irreversibly stops the RTCRtpTransceiver. The sender of
117 * this transceiver will no longer send, the receiver will no longer receive.
118 * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
119 */
Harald Alvestrand6060df52020-08-11 09:54:02 +0200120- (void)stopInternal;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200121
122@end
123
Mirko Bonadeie8d57242018-09-17 10:22:56 +0200124RTC_OBJC_EXPORT
Mirko Bonadeia81e9c82020-05-04 16:14:32 +0200125@interface RTC_OBJC_TYPE (RTCRtpTransceiver) : NSObject <RTC_OBJC_TYPE(RTCRtpTransceiver)>
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200126
127- (instancetype)init NS_UNAVAILABLE;
128
129@end
130
131NS_ASSUME_NONNULL_END