blob: c7a20533a35ea5377b0bb455fcf28761c78315b8 [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) {
Henrik Boström766c80b2022-01-12 17:46:03 +010066 // TODO(https://crbug.com/webrtc/13528): Remove support for Plan B.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020067 RTCSdpSemanticsPlanB,
68 RTCSdpSemanticsUnifiedPlan,
Henrik Boström766c80b2022-01-12 17:46:03 +010069 // The default sdpSemantics value is about to change to Unified Plan. During
70 // a short transition period, NotSpecified is used to ensure clients that
71 // don't set sdpSemantics are aware of the change by CHECK-crashing.
72 // TODO(https://crbug.com/webrtc/11121): When the default has changed to
73 // UnifiedPlan, delete NotSpecified.
74 RTCSdpSemanticsNotSpecified,
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020075};
76
77NS_ASSUME_NONNULL_BEGIN
78
Mirko Bonadeie8d57242018-09-17 10:22:56 +020079RTC_OBJC_EXPORT
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020080@interface RTC_OBJC_TYPE (RTCConfiguration) : NSObject
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020081
Taylor Brandstetter21c80322020-03-24 15:41:19 -070082/** If true, allows DSCP codes to be set on outgoing packets, configured using
83 * networkPriority field of RTCRtpEncodingParameters. Defaults to false.
84 */
85@property(nonatomic, assign) BOOL enableDscp;
86
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020087/** An array of Ice Servers available to be used by ICE. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020088@property(nonatomic, copy) NSArray<RTC_OBJC_TYPE(RTCIceServer) *> *iceServers;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020089
90/** An RTCCertificate for 're' use. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020091@property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCertificate) * certificate;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020092
93/** Which candidates the ICE agent is allowed to use. The W3C calls it
Artem Titovd7ac5812021-07-27 12:23:39 +020094 * `iceTransportPolicy`, while in C++ it is called `type`. */
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020095@property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
96
97/** The media-bundling policy to use when gathering ICE candidates. */
98@property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
99
100/** The rtcp-mux policy to use when gathering ICE candidates. */
101@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
102@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
103@property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
104@property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy;
105
Uladzislau Sushabf0d0c12018-11-05 12:48:35 +0300106/** If set to YES, don't gather IPv6 ICE candidates.
107 * Default is NO.
108 */
109@property(nonatomic, assign) BOOL disableIPV6;
110
111/** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi.
112 * Only intended to be used on specific devices. Certain phones disable IPv6
113 * when the screen is turned off and it would be better to just disable the
114 * IPv6 ICE candidates on Wi-Fi in those cases.
115 * Default is NO.
116 */
117@property(nonatomic, assign) BOOL disableIPV6OnWiFi;
118
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200119/** By default, the PeerConnection will use a limited number of IPv6 network
120 * interfaces, in order to avoid too many ICE candidate pairs being created
121 * and delaying ICE completion.
122 *
123 * Can be set to INT_MAX to effectively disable the limit.
124 */
125@property(nonatomic, assign) int maxIPv6Networks;
126
127/** Exclude link-local network interfaces
128 * from considertaion for gathering ICE candidates.
129 * Defaults to NO.
130 */
131@property(nonatomic, assign) BOOL disableLinkLocalNetworks;
132
133@property(nonatomic, assign) int audioJitterBufferMaxPackets;
134@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
135@property(nonatomic, assign) int iceConnectionReceivingTimeout;
136@property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
137
138/** Key type used to generate SSL identity. Default is ECDSA. */
139@property(nonatomic, assign) RTCEncryptionKeyType keyType;
140
141/** ICE candidate pool size as defined in JSEP. Default is 0. */
142@property(nonatomic, assign) int iceCandidatePoolSize;
143
144/** Prune turn ports on the same network to the same turn server.
145 * Default is NO.
146 */
147@property(nonatomic, assign) BOOL shouldPruneTurnPorts;
148
149/** If set to YES, this means the ICE transport should presume TURN-to-TURN
150 * candidate pairs will succeed, even before a binding response is received.
151 */
152@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
153
Artem Titovd7ac5812021-07-27 12:23:39 +0200154/* This flag is only effective when `continualGatheringPolicy` is
Qingsi Wang1fe119f2019-05-31 16:55:33 -0700155 * RTCContinualGatheringPolicyGatherContinually.
156 *
157 * If YES, after the ICE transport type is changed such that new types of
158 * ICE candidates are allowed by the new transport type, e.g. from
159 * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that
160 * have been gathered by the ICE transport but not matching the previous
161 * transport type and as a result not observed by PeerConnectionDelegateAdapter,
162 * will be surfaced to the delegate.
163 */
164@property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged;
165
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200166/** If set to non-nil, controls the minimal interval between consecutive ICE
167 * check packets.
168 */
169@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
170
Henrik Boström766c80b2022-01-12 17:46:03 +0100171/** Configure the SDP semantics used by this PeerConnection. The WebRTC 1.0
172 * specification requires RTCSdpSemanticsUnifiedPlan semantics and the
173 * RtpTransceiver API is only available in Unified Plan. RTCSdpSemanticsPlanB
174 * is being deprecated and will be removed at a future date.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200175 *
176 * PlanB will cause RTCPeerConnection to create offers and answers with at
177 * most one audio and one video m= section with multiple RTCRtpSenders and
178 * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This
179 * will also cause RTCPeerConnection to ignore all but the first m= section of
180 * the same media type.
181 *
182 * UnifiedPlan will cause RTCPeerConnection to create offers and answers with
183 * multiple m= sections where each m= section maps to one RTCRtpSender and one
Mirko Bonadeia81e9c82020-05-04 16:14:32 +0200184 * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both
Henrik Boström766c80b2022-01-12 17:46:03 +0100185 * video. This will also cause RTCPeerConnection) to ignore all but the first
186 * a=ssrc lines that form a Plan B stream.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200187 *
Henrik Boström766c80b2022-01-12 17:46:03 +0100188 * For users who have to interwork with legacy WebRTC implementations, it
189 * is possible to specify PlanB until the code is finally removed
190 * (https://crbug.com/webrtc/13528).
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200191 *
Henrik Boström766c80b2022-01-12 17:46:03 +0100192 * The default SdpSemantics value is about to change to UnifiedPlan. During a
193 * short transition period, NotSpecified is used to ensure clients that don't
194 * set SdpSemantics are aware of the change by CHECK-crashing.
195 * TODO(https://crbug.com/webrtc/11121): When the default has changed to
196 * UnifiedPlan, delete NotSpecified.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200197 */
198@property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
199
200/** Actively reset the SRTP parameters when the DTLS transports underneath are
201 * changed after offer/answer negotiation. This is only intended to be a
202 * workaround for crbug.com/835958
203 */
204@property(nonatomic, assign) BOOL activeResetSrtpParams;
205
philipel3eb84f02019-11-11 12:57:44 +0100206/** If the remote side support mid-stream codec switches then allow encoder
207 * switching to be performed.
208 */
209
210@property(nonatomic, assign) BOOL allowCodecSwitching;
211
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -0700212/**
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700213 * Defines advanced optional cryptographic settings related to SRTP and
214 * frame encryption for native WebRTC. Setting this will overwrite any
215 * options set through the PeerConnectionFactory (which is deprecated).
216 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +0200217@property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions;
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700218
Jiawei Oub1e47752018-11-13 23:48:19 -0800219/**
Brad Pughf24143d2020-11-16 16:27:20 -0800220 * An optional string that will be attached to the TURN_ALLOCATE_REQUEST which
221 * which can be used to correlate client logs with backend logs.
222 */
223@property(nonatomic, nullable, copy) NSString *turnLoggingId;
224
225/**
Jiawei Oub1e47752018-11-13 23:48:19 -0800226 * Time interval between audio RTCP reports.
227 */
228@property(nonatomic, assign) int rtcpAudioReportIntervalMs;
229
230/**
231 * Time interval between video RTCP reports.
232 */
233@property(nonatomic, assign) int rtcpVideoReportIntervalMs;
234
Yura Yaroshevich41736142021-03-16 18:04:36 +0300235/**
236 * Allow implicit rollback of local description when remote description
237 * conflicts with local description.
238 * See: https://w3c.github.io/webrtc-pc/#dom-peerconnection-setremotedescription
239 */
240@property(nonatomic, assign) BOOL enableImplicitRollback;
241
Yura Yaroshevichcbadb8b2021-03-17 17:39:52 +0300242/**
243 * Control if "a=extmap-allow-mixed" is included in the offer.
244 * See: https://www.chromestatus.com/feature/6269234631933952
245 */
246@property(nonatomic, assign) BOOL offerExtmapAllowMixed;
247
Yura Yaroshevichb9fa3192021-03-31 16:48:39 +0300248/**
249 * Defines the interval applied to ALL candidate pairs
250 * when ICE is strongly connected, and it overrides the
251 * default value of this interval in the ICE implementation;
252 */
253@property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalStrongConnectivity;
254
255/**
256 * Defines the counterpart for ALL pairs when ICE is
257 * weakly connected, and it overrides the default value of
258 * this interval in the ICE implementation
259 */
260@property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalWeakConnectivity;
261
262/**
263 * The min time period for which a candidate pair must wait for response to
264 * connectivity checks before it becomes unwritable. This parameter
265 * overrides the default value in the ICE implementation if set.
266 */
267@property(nonatomic, copy, nullable) NSNumber *iceUnwritableTimeout;
268
269/**
270 * The min number of connectivity checks that a candidate pair must sent
271 * without receiving response before it becomes unwritable. This parameter
272 * overrides the default value in the ICE implementation if set.
273 */
274@property(nonatomic, copy, nullable) NSNumber *iceUnwritableMinChecks;
275
276/**
277 * The min time period for which a candidate pair must wait for response to
278 * connectivity checks it becomes inactive. This parameter overrides the
279 * default value in the ICE implementation if set.
280 */
281@property(nonatomic, copy, nullable) NSNumber *iceInactiveTimeout;
282
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200283- (instancetype)init;
284
285@end
286
287NS_ASSUME_NONNULL_END