blob: 4356b8d49478bc27466fd2fdcb0997c6df9654fc [file] [log] [blame]
Anders Carlsson7bca8ca2018-08-30 09:30:29 +02001/*
2 * Copyright 2015 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 "RTCCertificate.h"
Benjamin Wright8c27cca2018-10-25 10:16:44 -070014#import "RTCCryptoOptions.h"
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020015#import "RTCMacros.h"
16
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020017@class RTC_OBJC_TYPE(RTCIceServer);
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020018
19/**
20 * Represents the ice transport policy. This exposes the same states in C++,
21 * which include one more state than what exists in the W3C spec.
22 */
23typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) {
24 RTCIceTransportPolicyNone,
25 RTCIceTransportPolicyRelay,
26 RTCIceTransportPolicyNoHost,
27 RTCIceTransportPolicyAll
28};
29
30/** Represents the bundle policy. */
31typedef NS_ENUM(NSInteger, RTCBundlePolicy) {
32 RTCBundlePolicyBalanced,
33 RTCBundlePolicyMaxCompat,
34 RTCBundlePolicyMaxBundle
35};
36
37/** Represents the rtcp mux policy. */
38typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire };
39
40/** Represents the tcp candidate policy. */
41typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) {
42 RTCTcpCandidatePolicyEnabled,
43 RTCTcpCandidatePolicyDisabled
44};
45
46/** Represents the candidate network policy. */
47typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) {
48 RTCCandidateNetworkPolicyAll,
49 RTCCandidateNetworkPolicyLowCost
50};
51
52/** Represents the continual gathering policy. */
53typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) {
54 RTCContinualGatheringPolicyGatherOnce,
55 RTCContinualGatheringPolicyGatherContinually
56};
57
58/** Represents the encryption key type. */
59typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) {
60 RTCEncryptionKeyTypeRSA,
61 RTCEncryptionKeyTypeECDSA,
62};
63
64/** Represents the chosen SDP semantics for the RTCPeerConnection. */
65typedef NS_ENUM(NSInteger, RTCSdpSemantics) {
66 RTCSdpSemanticsPlanB,
67 RTCSdpSemanticsUnifiedPlan,
68};
69
70NS_ASSUME_NONNULL_BEGIN
71
Mirko Bonadeie8d57242018-09-17 10:22:56 +020072RTC_OBJC_EXPORT
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020073@interface RTC_OBJC_TYPE (RTCConfiguration) : NSObject
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020074
Taylor Brandstetter21c80322020-03-24 15:41:19 -070075/** If true, allows DSCP codes to be set on outgoing packets, configured using
76 * networkPriority field of RTCRtpEncodingParameters. Defaults to false.
77 */
78@property(nonatomic, assign) BOOL enableDscp;
79
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020080/** An array of Ice Servers available to be used by ICE. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020081@property(nonatomic, copy) NSArray<RTC_OBJC_TYPE(RTCIceServer) *> *iceServers;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020082
83/** An RTCCertificate for 're' use. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020084@property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCertificate) * certificate;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020085
86/** Which candidates the ICE agent is allowed to use. The W3C calls it
Artem Titovd7ac5812021-07-27 12:23:39 +020087 * `iceTransportPolicy`, while in C++ it is called `type`. */
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020088@property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
89
90/** The media-bundling policy to use when gathering ICE candidates. */
91@property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
92
93/** The rtcp-mux policy to use when gathering ICE candidates. */
94@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
95@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
96@property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
97@property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy;
98
Uladzislau Sushabf0d0c12018-11-05 12:48:35 +030099/** If set to YES, don't gather IPv6 ICE candidates.
100 * Default is NO.
101 */
102@property(nonatomic, assign) BOOL disableIPV6;
103
104/** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi.
105 * Only intended to be used on specific devices. Certain phones disable IPv6
106 * when the screen is turned off and it would be better to just disable the
107 * IPv6 ICE candidates on Wi-Fi in those cases.
108 * Default is NO.
109 */
110@property(nonatomic, assign) BOOL disableIPV6OnWiFi;
111
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200112/** By default, the PeerConnection will use a limited number of IPv6 network
113 * interfaces, in order to avoid too many ICE candidate pairs being created
114 * and delaying ICE completion.
115 *
116 * Can be set to INT_MAX to effectively disable the limit.
117 */
118@property(nonatomic, assign) int maxIPv6Networks;
119
120/** Exclude link-local network interfaces
121 * from considertaion for gathering ICE candidates.
122 * Defaults to NO.
123 */
124@property(nonatomic, assign) BOOL disableLinkLocalNetworks;
125
126@property(nonatomic, assign) int audioJitterBufferMaxPackets;
127@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
128@property(nonatomic, assign) int iceConnectionReceivingTimeout;
129@property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
130
131/** Key type used to generate SSL identity. Default is ECDSA. */
132@property(nonatomic, assign) RTCEncryptionKeyType keyType;
133
134/** ICE candidate pool size as defined in JSEP. Default is 0. */
135@property(nonatomic, assign) int iceCandidatePoolSize;
136
137/** Prune turn ports on the same network to the same turn server.
138 * Default is NO.
139 */
140@property(nonatomic, assign) BOOL shouldPruneTurnPorts;
141
142/** If set to YES, this means the ICE transport should presume TURN-to-TURN
143 * candidate pairs will succeed, even before a binding response is received.
144 */
145@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
146
Artem Titovd7ac5812021-07-27 12:23:39 +0200147/* This flag is only effective when `continualGatheringPolicy` is
Qingsi Wang1fe119f2019-05-31 16:55:33 -0700148 * RTCContinualGatheringPolicyGatherContinually.
149 *
150 * If YES, after the ICE transport type is changed such that new types of
151 * ICE candidates are allowed by the new transport type, e.g. from
152 * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that
153 * have been gathered by the ICE transport but not matching the previous
154 * transport type and as a result not observed by PeerConnectionDelegateAdapter,
155 * will be surfaced to the delegate.
156 */
157@property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged;
158
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200159/** If set to non-nil, controls the minimal interval between consecutive ICE
160 * check packets.
161 */
162@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
163
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200164/** Configure the SDP semantics used by this PeerConnection. Note that the
165 * WebRTC 1.0 specification requires UnifiedPlan semantics. The
166 * RTCRtpTransceiver API is only available with UnifiedPlan semantics.
167 *
168 * PlanB will cause RTCPeerConnection to create offers and answers with at
169 * most one audio and one video m= section with multiple RTCRtpSenders and
170 * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This
171 * will also cause RTCPeerConnection to ignore all but the first m= section of
172 * the same media type.
173 *
174 * UnifiedPlan will cause RTCPeerConnection to create offers and answers with
175 * multiple m= sections where each m= section maps to one RTCRtpSender and one
Mirko Bonadeia81e9c82020-05-04 16:14:32 +0200176 * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both
177 * video. This will also cause RTCPeerConnection) to ignore all but the first a=ssrc
178 * lines that form a Plan B stream.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200179 *
180 * For users who wish to send multiple audio/video streams and need to stay
181 * interoperable with legacy WebRTC implementations or use legacy APIs,
182 * specify PlanB.
183 *
184 * For all other users, specify UnifiedPlan.
185 */
186@property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
187
188/** Actively reset the SRTP parameters when the DTLS transports underneath are
189 * changed after offer/answer negotiation. This is only intended to be a
190 * workaround for crbug.com/835958
191 */
192@property(nonatomic, assign) BOOL activeResetSrtpParams;
193
philipel3eb84f02019-11-11 12:57:44 +0100194/** If the remote side support mid-stream codec switches then allow encoder
195 * switching to be performed.
196 */
197
198@property(nonatomic, assign) BOOL allowCodecSwitching;
199
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -0700200/**
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700201 * Defines advanced optional cryptographic settings related to SRTP and
202 * frame encryption for native WebRTC. Setting this will overwrite any
203 * options set through the PeerConnectionFactory (which is deprecated).
204 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +0200205@property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions;
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700206
Jiawei Oub1e47752018-11-13 23:48:19 -0800207/**
Brad Pughf24143d2020-11-16 16:27:20 -0800208 * An optional string that will be attached to the TURN_ALLOCATE_REQUEST which
209 * which can be used to correlate client logs with backend logs.
210 */
211@property(nonatomic, nullable, copy) NSString *turnLoggingId;
212
213/**
Jiawei Oub1e47752018-11-13 23:48:19 -0800214 * Time interval between audio RTCP reports.
215 */
216@property(nonatomic, assign) int rtcpAudioReportIntervalMs;
217
218/**
219 * Time interval between video RTCP reports.
220 */
221@property(nonatomic, assign) int rtcpVideoReportIntervalMs;
222
Yura Yaroshevich41736142021-03-16 18:04:36 +0300223/**
224 * Allow implicit rollback of local description when remote description
225 * conflicts with local description.
226 * See: https://w3c.github.io/webrtc-pc/#dom-peerconnection-setremotedescription
227 */
228@property(nonatomic, assign) BOOL enableImplicitRollback;
229
Yura Yaroshevichcbadb8b2021-03-17 17:39:52 +0300230/**
231 * Control if "a=extmap-allow-mixed" is included in the offer.
232 * See: https://www.chromestatus.com/feature/6269234631933952
233 */
234@property(nonatomic, assign) BOOL offerExtmapAllowMixed;
235
Yura Yaroshevichb9fa3192021-03-31 16:48:39 +0300236/**
237 * Defines the interval applied to ALL candidate pairs
238 * when ICE is strongly connected, and it overrides the
239 * default value of this interval in the ICE implementation;
240 */
241@property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalStrongConnectivity;
242
243/**
244 * Defines the counterpart for ALL pairs when ICE is
245 * weakly connected, and it overrides the default value of
246 * this interval in the ICE implementation
247 */
248@property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalWeakConnectivity;
249
250/**
251 * The min time period for which a candidate pair must wait for response to
252 * connectivity checks before it becomes unwritable. This parameter
253 * overrides the default value in the ICE implementation if set.
254 */
255@property(nonatomic, copy, nullable) NSNumber *iceUnwritableTimeout;
256
257/**
258 * The min number of connectivity checks that a candidate pair must sent
259 * without receiving response before it becomes unwritable. This parameter
260 * overrides the default value in the ICE implementation if set.
261 */
262@property(nonatomic, copy, nullable) NSNumber *iceUnwritableMinChecks;
263
264/**
265 * The min time period for which a candidate pair must wait for response to
266 * connectivity checks it becomes inactive. This parameter overrides the
267 * default value in the ICE implementation if set.
268 */
269@property(nonatomic, copy, nullable) NSNumber *iceInactiveTimeout;
270
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200271- (instancetype)init;
272
273@end
274
275NS_ASSUME_NONNULL_END