blob: 7400296451e469622db29d37cc2373db57724214 [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
17@class 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
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020073@interface RTCConfiguration : NSObject
74
75/** An array of Ice Servers available to be used by ICE. */
76@property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers;
77
78/** An RTCCertificate for 're' use. */
79@property(nonatomic, nullable) RTCCertificate *certificate;
80
81/** Which candidates the ICE agent is allowed to use. The W3C calls it
82 * |iceTransportPolicy|, while in C++ it is called |type|. */
83@property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
84
85/** The media-bundling policy to use when gathering ICE candidates. */
86@property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
87
88/** The rtcp-mux policy to use when gathering ICE candidates. */
89@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
90@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
91@property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
92@property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy;
93
Uladzislau Sushabf0d0c12018-11-05 12:48:35 +030094/** If set to YES, don't gather IPv6 ICE candidates.
95 * Default is NO.
96 */
97@property(nonatomic, assign) BOOL disableIPV6;
98
99/** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi.
100 * Only intended to be used on specific devices. Certain phones disable IPv6
101 * when the screen is turned off and it would be better to just disable the
102 * IPv6 ICE candidates on Wi-Fi in those cases.
103 * Default is NO.
104 */
105@property(nonatomic, assign) BOOL disableIPV6OnWiFi;
106
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200107/** By default, the PeerConnection will use a limited number of IPv6 network
108 * interfaces, in order to avoid too many ICE candidate pairs being created
109 * and delaying ICE completion.
110 *
111 * Can be set to INT_MAX to effectively disable the limit.
112 */
113@property(nonatomic, assign) int maxIPv6Networks;
114
115/** Exclude link-local network interfaces
116 * from considertaion for gathering ICE candidates.
117 * Defaults to NO.
118 */
119@property(nonatomic, assign) BOOL disableLinkLocalNetworks;
120
121@property(nonatomic, assign) int audioJitterBufferMaxPackets;
122@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
123@property(nonatomic, assign) int iceConnectionReceivingTimeout;
124@property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
125
126/** Key type used to generate SSL identity. Default is ECDSA. */
127@property(nonatomic, assign) RTCEncryptionKeyType keyType;
128
129/** ICE candidate pool size as defined in JSEP. Default is 0. */
130@property(nonatomic, assign) int iceCandidatePoolSize;
131
132/** Prune turn ports on the same network to the same turn server.
133 * Default is NO.
134 */
135@property(nonatomic, assign) BOOL shouldPruneTurnPorts;
136
137/** If set to YES, this means the ICE transport should presume TURN-to-TURN
138 * candidate pairs will succeed, even before a binding response is received.
139 */
140@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
141
Qingsi Wang1fe119f2019-05-31 16:55:33 -0700142/* This flag is only effective when |continualGatheringPolicy| is
143 * RTCContinualGatheringPolicyGatherContinually.
144 *
145 * If YES, after the ICE transport type is changed such that new types of
146 * ICE candidates are allowed by the new transport type, e.g. from
147 * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that
148 * have been gathered by the ICE transport but not matching the previous
149 * transport type and as a result not observed by PeerConnectionDelegateAdapter,
150 * will be surfaced to the delegate.
151 */
152@property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged;
153
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200154/** If set to non-nil, controls the minimal interval between consecutive ICE
155 * check packets.
156 */
157@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
158
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200159/** Configure the SDP semantics used by this PeerConnection. Note that the
160 * WebRTC 1.0 specification requires UnifiedPlan semantics. The
161 * RTCRtpTransceiver API is only available with UnifiedPlan semantics.
162 *
163 * PlanB will cause RTCPeerConnection to create offers and answers with at
164 * most one audio and one video m= section with multiple RTCRtpSenders and
165 * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This
166 * will also cause RTCPeerConnection to ignore all but the first m= section of
167 * the same media type.
168 *
169 * UnifiedPlan will cause RTCPeerConnection to create offers and answers with
170 * multiple m= sections where each m= section maps to one RTCRtpSender and one
171 * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This
172 * will also cause RTCPeerConnection to ignore all but the first a=ssrc lines
173 * that form a Plan B stream.
174 *
175 * For users who wish to send multiple audio/video streams and need to stay
176 * interoperable with legacy WebRTC implementations or use legacy APIs,
177 * specify PlanB.
178 *
179 * For all other users, specify UnifiedPlan.
180 */
181@property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
182
183/** Actively reset the SRTP parameters when the DTLS transports underneath are
184 * changed after offer/answer negotiation. This is only intended to be a
185 * workaround for crbug.com/835958
186 */
187@property(nonatomic, assign) BOOL activeResetSrtpParams;
188
philipel3eb84f02019-11-11 12:57:44 +0100189/** If the remote side support mid-stream codec switches then allow encoder
190 * switching to be performed.
191 */
192
193@property(nonatomic, assign) BOOL allowCodecSwitching;
194
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -0700195/**
196 * If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection
197 * that it should use the MediaTransportInterface.
198 */
199@property(nonatomic, assign) BOOL useMediaTransport;
200
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700201/**
Bjorn Mellema9bbd862018-11-02 09:07:48 -0700202 * If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection
203 * that it should use the MediaTransportInterface for data channels.
204 */
205@property(nonatomic, assign) BOOL useMediaTransportForDataChannels;
206
207/**
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700208 * Defines advanced optional cryptographic settings related to SRTP and
209 * frame encryption for native WebRTC. Setting this will overwrite any
210 * options set through the PeerConnectionFactory (which is deprecated).
211 */
212@property(nonatomic, nullable) RTCCryptoOptions *cryptoOptions;
213
Jiawei Oub1e47752018-11-13 23:48:19 -0800214/**
215 * Time interval between audio RTCP reports.
216 */
217@property(nonatomic, assign) int rtcpAudioReportIntervalMs;
218
219/**
220 * Time interval between video RTCP reports.
221 */
222@property(nonatomic, assign) int rtcpVideoReportIntervalMs;
223
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200224- (instancetype)init;
225
226@end
227
228NS_ASSUME_NONNULL_END