blob: b9a9e4b137b19ae1a97905901a91c342abe2cb66 [file] [log] [blame]
hjon6d49a8e2016-01-26 13:06:42 -08001/*
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
tkchin9eeb6242016-04-27 01:54:20 -070011#import "RTCConfiguration+Private.h"
hjon6d49a8e2016-01-26 13:06:42 -080012
jbauch555604a2016-04-26 03:13:22 -070013#include <memory>
14
tkchin9eeb6242016-04-27 01:54:20 -070015#import "RTCIceServer+Private.h"
Steve Antond295e402017-07-14 16:06:41 -070016#import "RTCIntervalRange+Private.h"
tkchin9eeb6242016-04-27 01:54:20 -070017#import "WebRTC/RTCLogging.h"
tkchinab8f82f2016-01-27 17:50:11 -080018
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "rtc_base/rtccertificategenerator.h"
20#include "rtc_base/sslidentity.h"
hjon6d49a8e2016-01-26 13:06:42 -080021
22@implementation RTCConfiguration
23
24@synthesize iceServers = _iceServers;
25@synthesize iceTransportPolicy = _iceTransportPolicy;
26@synthesize bundlePolicy = _bundlePolicy;
27@synthesize rtcpMuxPolicy = _rtcpMuxPolicy;
28@synthesize tcpCandidatePolicy = _tcpCandidatePolicy;
Honghai Zhang46007ae2016-06-03 16:31:32 -070029@synthesize candidateNetworkPolicy = _candidateNetworkPolicy;
Honghai Zhang3108fc92016-05-11 10:10:39 -070030@synthesize continualGatheringPolicy = _continualGatheringPolicy;
deadbeef2059bb32017-07-26 18:25:43 -070031@synthesize maxIPv6Networks = _maxIPv6Networks;
hjon6d49a8e2016-01-26 13:06:42 -080032@synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets;
hayscc9f95002016-12-05 14:24:32 -080033@synthesize audioJitterBufferFastAccelerate = _audioJitterBufferFastAccelerate;
hjon6d49a8e2016-01-26 13:06:42 -080034@synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout;
35@synthesize iceBackupCandidatePairPingInterval =
36 _iceBackupCandidatePairPingInterval;
tkchinab8f82f2016-01-27 17:50:11 -080037@synthesize keyType = _keyType;
deadbeefbe0c96f2016-05-18 16:20:14 -070038@synthesize iceCandidatePoolSize = _iceCandidatePoolSize;
honghaizaf6b6e02016-07-11 15:09:26 -070039@synthesize shouldPruneTurnPorts = _shouldPruneTurnPorts;
40@synthesize shouldPresumeWritableWhenFullyRelayed =
41 _shouldPresumeWritableWhenFullyRelayed;
skvlada5d94ff2017-02-02 13:02:30 -080042@synthesize iceCheckMinInterval = _iceCheckMinInterval;
Steve Antond295e402017-07-14 16:06:41 -070043@synthesize iceRegatherIntervalRange = _iceRegatherIntervalRange;
hjon6d49a8e2016-01-26 13:06:42 -080044
45- (instancetype)init {
jtteh4eeb5372017-04-03 15:06:37 -070046 // Copy defaults.
47 webrtc::PeerConnectionInterface::RTCConfiguration config(
48 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive);
jtteh465faf02017-04-04 14:00:16 -070049 return [self initWithNativeConfiguration:config];
jtteh4eeb5372017-04-03 15:06:37 -070050}
51
52- (instancetype)initWithNativeConfiguration:
jtteh465faf02017-04-04 14:00:16 -070053 (const webrtc::PeerConnectionInterface::RTCConfiguration &)config {
hjon6d49a8e2016-01-26 13:06:42 -080054 if (self = [super init]) {
jtteh4eeb5372017-04-03 15:06:37 -070055 NSMutableArray *iceServers = [NSMutableArray array];
jtteh465faf02017-04-04 14:00:16 -070056 for (const webrtc::PeerConnectionInterface::IceServer& server : config.servers) {
jtteh4eeb5372017-04-03 15:06:37 -070057 RTCIceServer *iceServer = [[RTCIceServer alloc] initWithNativeServer:server];
58 [iceServers addObject:iceServer];
59 }
60 _iceServers = iceServers;
hjon6d49a8e2016-01-26 13:06:42 -080061 _iceTransportPolicy =
jtteh465faf02017-04-04 14:00:16 -070062 [[self class] transportPolicyForTransportsType:config.type];
hjon6d49a8e2016-01-26 13:06:42 -080063 _bundlePolicy =
jtteh465faf02017-04-04 14:00:16 -070064 [[self class] bundlePolicyForNativePolicy:config.bundle_policy];
hjon6d49a8e2016-01-26 13:06:42 -080065 _rtcpMuxPolicy =
jtteh465faf02017-04-04 14:00:16 -070066 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy];
hjon6d49a8e2016-01-26 13:06:42 -080067 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy:
jtteh465faf02017-04-04 14:00:16 -070068 config.tcp_candidate_policy];
Honghai Zhang46007ae2016-06-03 16:31:32 -070069 _candidateNetworkPolicy = [[self class]
jtteh465faf02017-04-04 14:00:16 -070070 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy];
Honghai Zhang3108fc92016-05-11 10:10:39 -070071 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy =
jtteh465faf02017-04-04 14:00:16 -070072 config.continual_gathering_policy;
Honghai Zhang3108fc92016-05-11 10:10:39 -070073 _continualGatheringPolicy =
74 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy];
deadbeef2059bb32017-07-26 18:25:43 -070075 _maxIPv6Networks = config.max_ipv6_networks;
jtteh465faf02017-04-04 14:00:16 -070076 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets;
77 _audioJitterBufferFastAccelerate = config.audio_jitter_buffer_fast_accelerate;
78 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout;
hjon6d49a8e2016-01-26 13:06:42 -080079 _iceBackupCandidatePairPingInterval =
jtteh465faf02017-04-04 14:00:16 -070080 config.ice_backup_candidate_pair_ping_interval;
tkchinab8f82f2016-01-27 17:50:11 -080081 _keyType = RTCEncryptionKeyTypeECDSA;
jtteh465faf02017-04-04 14:00:16 -070082 _iceCandidatePoolSize = config.ice_candidate_pool_size;
83 _shouldPruneTurnPorts = config.prune_turn_ports;
honghaizaf6b6e02016-07-11 15:09:26 -070084 _shouldPresumeWritableWhenFullyRelayed =
jtteh465faf02017-04-04 14:00:16 -070085 config.presume_writable_when_fully_relayed;
86 if (config.ice_check_min_interval) {
skvlada5d94ff2017-02-02 13:02:30 -080087 _iceCheckMinInterval =
jtteh465faf02017-04-04 14:00:16 -070088 [NSNumber numberWithInt:*config.ice_check_min_interval];
skvlada5d94ff2017-02-02 13:02:30 -080089 }
Steve Antond295e402017-07-14 16:06:41 -070090 if (config.ice_regather_interval_range) {
91 const rtc::IntervalRange &nativeIntervalRange = config.ice_regather_interval_range.value();
92 _iceRegatherIntervalRange =
93 [[RTCIntervalRange alloc] initWithNativeIntervalRange:nativeIntervalRange];
94 }
hjon6d49a8e2016-01-26 13:06:42 -080095 }
96 return self;
97}
98
99- (NSString *)description {
deadbeef2059bb32017-07-26 18:25:43 -0700100 return
101 [NSString stringWithFormat:
102 @"RTCConfiguration: "
103 @"{\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%@\n%@\n%d\n}\n",
104 _iceServers,
105 [[self class] stringForTransportPolicy:_iceTransportPolicy],
106 [[self class] stringForBundlePolicy:_bundlePolicy],
107 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy],
108 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy],
109 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy],
110 [[self class] stringForContinualGatheringPolicy:_continualGatheringPolicy],
111 _audioJitterBufferMaxPackets,
112 _audioJitterBufferFastAccelerate,
113 _iceConnectionReceivingTimeout,
114 _iceBackupCandidatePairPingInterval,
115 _iceCandidatePoolSize,
116 _shouldPruneTurnPorts,
117 _shouldPresumeWritableWhenFullyRelayed,
118 _iceCheckMinInterval,
119 _iceRegatherIntervalRange,
120 _maxIPv6Networks];
hjon6d49a8e2016-01-26 13:06:42 -0800121}
122
123#pragma mark - Private
124
hbosa73ca562016-05-17 03:28:58 -0700125- (webrtc::PeerConnectionInterface::RTCConfiguration *)
126 createNativeConfiguration {
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200127 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration>
Honghai Zhangf7ddc062016-09-01 15:34:01 -0700128 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration(
129 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive));
hjon6d49a8e2016-01-26 13:06:42 -0800130
131 for (RTCIceServer *iceServer in _iceServers) {
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200132 nativeConfig->servers.push_back(iceServer.nativeServer);
hjon6d49a8e2016-01-26 13:06:42 -0800133 }
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200134 nativeConfig->type =
hjon6d49a8e2016-01-26 13:06:42 -0800135 [[self class] nativeTransportsTypeForTransportPolicy:_iceTransportPolicy];
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200136 nativeConfig->bundle_policy =
hjon6d49a8e2016-01-26 13:06:42 -0800137 [[self class] nativeBundlePolicyForPolicy:_bundlePolicy];
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200138 nativeConfig->rtcp_mux_policy =
hjon6d49a8e2016-01-26 13:06:42 -0800139 [[self class] nativeRtcpMuxPolicyForPolicy:_rtcpMuxPolicy];
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200140 nativeConfig->tcp_candidate_policy =
hjon6d49a8e2016-01-26 13:06:42 -0800141 [[self class] nativeTcpCandidatePolicyForPolicy:_tcpCandidatePolicy];
Honghai Zhang46007ae2016-06-03 16:31:32 -0700142 nativeConfig->candidate_network_policy = [[self class]
143 nativeCandidateNetworkPolicyForPolicy:_candidateNetworkPolicy];
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200144 nativeConfig->continual_gathering_policy = [[self class]
Honghai Zhang3108fc92016-05-11 10:10:39 -0700145 nativeContinualGatheringPolicyForPolicy:_continualGatheringPolicy];
deadbeef2059bb32017-07-26 18:25:43 -0700146 nativeConfig->max_ipv6_networks = _maxIPv6Networks;
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200147 nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets;
hayscc9f95002016-12-05 14:24:32 -0800148 nativeConfig->audio_jitter_buffer_fast_accelerate =
149 _audioJitterBufferFastAccelerate ? true : false;
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200150 nativeConfig->ice_connection_receiving_timeout =
hjon6d49a8e2016-01-26 13:06:42 -0800151 _iceConnectionReceivingTimeout;
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200152 nativeConfig->ice_backup_candidate_pair_ping_interval =
hjon6d49a8e2016-01-26 13:06:42 -0800153 _iceBackupCandidatePairPingInterval;
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200154 rtc::KeyType keyType =
155 [[self class] nativeEncryptionKeyTypeForKeyType:_keyType];
156 // Generate non-default certificate.
157 if (keyType != rtc::KT_DEFAULT) {
158 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
159 rtc::RTCCertificateGenerator::GenerateCertificate(
160 rtc::KeyParams(keyType), rtc::Optional<uint64_t>());
161 if (!certificate) {
hbosa73ca562016-05-17 03:28:58 -0700162 RTCLogError(@"Failed to generate certificate.");
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200163 return nullptr;
tkchinab8f82f2016-01-27 17:50:11 -0800164 }
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200165 nativeConfig->certificates.push_back(certificate);
tkchinab8f82f2016-01-27 17:50:11 -0800166 }
deadbeefbe0c96f2016-05-18 16:20:14 -0700167 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize;
honghaizaf6b6e02016-07-11 15:09:26 -0700168 nativeConfig->prune_turn_ports = _shouldPruneTurnPorts ? true : false;
Taylor Brandstettere9851112016-07-01 11:11:13 -0700169 nativeConfig->presume_writable_when_fully_relayed =
honghaizaf6b6e02016-07-11 15:09:26 -0700170 _shouldPresumeWritableWhenFullyRelayed ? true : false;
skvlada5d94ff2017-02-02 13:02:30 -0800171 if (_iceCheckMinInterval != nil) {
172 nativeConfig->ice_check_min_interval =
173 rtc::Optional<int>(_iceCheckMinInterval.intValue);
174 }
Steve Antond295e402017-07-14 16:06:41 -0700175 if (_iceRegatherIntervalRange != nil) {
176 std::unique_ptr<rtc::IntervalRange> nativeIntervalRange(
177 _iceRegatherIntervalRange.nativeIntervalRange);
178 nativeConfig->ice_regather_interval_range =
179 rtc::Optional<rtc::IntervalRange>(*nativeIntervalRange);
180 }
hjon6d49a8e2016-01-26 13:06:42 -0800181
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200182 return nativeConfig.release();
hjon6d49a8e2016-01-26 13:06:42 -0800183}
184
hjon6d49a8e2016-01-26 13:06:42 -0800185+ (webrtc::PeerConnectionInterface::IceTransportsType)
186 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy {
187 switch (policy) {
188 case RTCIceTransportPolicyNone:
189 return webrtc::PeerConnectionInterface::kNone;
190 case RTCIceTransportPolicyRelay:
191 return webrtc::PeerConnectionInterface::kRelay;
192 case RTCIceTransportPolicyNoHost:
193 return webrtc::PeerConnectionInterface::kNoHost;
194 case RTCIceTransportPolicyAll:
195 return webrtc::PeerConnectionInterface::kAll;
196 }
197}
198
199+ (RTCIceTransportPolicy)transportPolicyForTransportsType:
200 (webrtc::PeerConnectionInterface::IceTransportsType)nativeType {
201 switch (nativeType) {
202 case webrtc::PeerConnectionInterface::kNone:
203 return RTCIceTransportPolicyNone;
204 case webrtc::PeerConnectionInterface::kRelay:
205 return RTCIceTransportPolicyRelay;
206 case webrtc::PeerConnectionInterface::kNoHost:
207 return RTCIceTransportPolicyNoHost;
208 case webrtc::PeerConnectionInterface::kAll:
209 return RTCIceTransportPolicyAll;
210 }
211}
212
213+ (NSString *)stringForTransportPolicy:(RTCIceTransportPolicy)policy {
214 switch (policy) {
215 case RTCIceTransportPolicyNone:
216 return @"NONE";
217 case RTCIceTransportPolicyRelay:
218 return @"RELAY";
219 case RTCIceTransportPolicyNoHost:
220 return @"NO_HOST";
221 case RTCIceTransportPolicyAll:
222 return @"ALL";
223 }
224}
225
226+ (webrtc::PeerConnectionInterface::BundlePolicy)nativeBundlePolicyForPolicy:
227 (RTCBundlePolicy)policy {
228 switch (policy) {
229 case RTCBundlePolicyBalanced:
230 return webrtc::PeerConnectionInterface::kBundlePolicyBalanced;
231 case RTCBundlePolicyMaxCompat:
232 return webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat;
233 case RTCBundlePolicyMaxBundle:
234 return webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle;
235 }
236}
237
238+ (RTCBundlePolicy)bundlePolicyForNativePolicy:
239 (webrtc::PeerConnectionInterface::BundlePolicy)nativePolicy {
240 switch (nativePolicy) {
241 case webrtc::PeerConnectionInterface::kBundlePolicyBalanced:
242 return RTCBundlePolicyBalanced;
243 case webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat:
244 return RTCBundlePolicyMaxCompat;
245 case webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle:
246 return RTCBundlePolicyMaxBundle;
247 }
248}
249
250+ (NSString *)stringForBundlePolicy:(RTCBundlePolicy)policy {
251 switch (policy) {
252 case RTCBundlePolicyBalanced:
253 return @"BALANCED";
254 case RTCBundlePolicyMaxCompat:
255 return @"MAX_COMPAT";
256 case RTCBundlePolicyMaxBundle:
257 return @"MAX_BUNDLE";
258 }
259}
260
261+ (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeRtcpMuxPolicyForPolicy:
262 (RTCRtcpMuxPolicy)policy {
263 switch (policy) {
264 case RTCRtcpMuxPolicyNegotiate:
265 return webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate;
266 case RTCRtcpMuxPolicyRequire:
267 return webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire;
268 }
269}
270
271+ (RTCRtcpMuxPolicy)rtcpMuxPolicyForNativePolicy:
272 (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativePolicy {
273 switch (nativePolicy) {
274 case webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate:
275 return RTCRtcpMuxPolicyNegotiate;
276 case webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire:
277 return RTCRtcpMuxPolicyRequire;
278 }
279}
280
281+ (NSString *)stringForRtcpMuxPolicy:(RTCRtcpMuxPolicy)policy {
282 switch (policy) {
283 case RTCRtcpMuxPolicyNegotiate:
284 return @"NEGOTIATE";
285 case RTCRtcpMuxPolicyRequire:
286 return @"REQUIRE";
287 }
288}
289
290+ (webrtc::PeerConnectionInterface::TcpCandidatePolicy)
291 nativeTcpCandidatePolicyForPolicy:(RTCTcpCandidatePolicy)policy {
292 switch (policy) {
293 case RTCTcpCandidatePolicyEnabled:
294 return webrtc::PeerConnectionInterface::kTcpCandidatePolicyEnabled;
295 case RTCTcpCandidatePolicyDisabled:
296 return webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled;
297 }
298}
299
Honghai Zhang46007ae2016-06-03 16:31:32 -0700300+ (webrtc::PeerConnectionInterface::CandidateNetworkPolicy)
301 nativeCandidateNetworkPolicyForPolicy:(RTCCandidateNetworkPolicy)policy {
302 switch (policy) {
303 case RTCCandidateNetworkPolicyAll:
304 return webrtc::PeerConnectionInterface::kCandidateNetworkPolicyAll;
305 case RTCCandidateNetworkPolicyLowCost:
306 return webrtc::PeerConnectionInterface::kCandidateNetworkPolicyLowCost;
307 }
308}
309
hjon6d49a8e2016-01-26 13:06:42 -0800310+ (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativePolicy:
311 (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativePolicy {
312 switch (nativePolicy) {
313 case webrtc::PeerConnectionInterface::kTcpCandidatePolicyEnabled:
314 return RTCTcpCandidatePolicyEnabled;
315 case webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled:
316 return RTCTcpCandidatePolicyDisabled;
317 }
318}
319
320+ (NSString *)stringForTcpCandidatePolicy:(RTCTcpCandidatePolicy)policy {
321 switch (policy) {
322 case RTCTcpCandidatePolicyEnabled:
323 return @"TCP_ENABLED";
324 case RTCTcpCandidatePolicyDisabled:
325 return @"TCP_DISABLED";
326 }
327}
328
Honghai Zhang46007ae2016-06-03 16:31:32 -0700329+ (RTCCandidateNetworkPolicy)candidateNetworkPolicyForNativePolicy:
330 (webrtc::PeerConnectionInterface::CandidateNetworkPolicy)nativePolicy {
331 switch (nativePolicy) {
332 case webrtc::PeerConnectionInterface::kCandidateNetworkPolicyAll:
333 return RTCCandidateNetworkPolicyAll;
334 case webrtc::PeerConnectionInterface::kCandidateNetworkPolicyLowCost:
335 return RTCCandidateNetworkPolicyLowCost;
336 }
337}
338
339+ (NSString *)stringForCandidateNetworkPolicy:
340 (RTCCandidateNetworkPolicy)policy {
341 switch (policy) {
342 case RTCCandidateNetworkPolicyAll:
343 return @"CANDIDATE_ALL_NETWORKS";
344 case RTCCandidateNetworkPolicyLowCost:
345 return @"CANDIDATE_LOW_COST_NETWORKS";
346 }
347}
348
Honghai Zhang3108fc92016-05-11 10:10:39 -0700349+ (webrtc::PeerConnectionInterface::ContinualGatheringPolicy)
350 nativeContinualGatheringPolicyForPolicy:
351 (RTCContinualGatheringPolicy)policy {
352 switch (policy) {
353 case RTCContinualGatheringPolicyGatherOnce:
354 return webrtc::PeerConnectionInterface::GATHER_ONCE;
355 case RTCContinualGatheringPolicyGatherContinually:
356 return webrtc::PeerConnectionInterface::GATHER_CONTINUALLY;
357 }
358}
359
360+ (RTCContinualGatheringPolicy)continualGatheringPolicyForNativePolicy:
361 (webrtc::PeerConnectionInterface::ContinualGatheringPolicy)nativePolicy {
362 switch (nativePolicy) {
363 case webrtc::PeerConnectionInterface::GATHER_ONCE:
364 return RTCContinualGatheringPolicyGatherOnce;
365 case webrtc::PeerConnectionInterface::GATHER_CONTINUALLY:
366 return RTCContinualGatheringPolicyGatherContinually;
367 }
368}
369
370+ (NSString *)stringForContinualGatheringPolicy:
371 (RTCContinualGatheringPolicy)policy {
372 switch (policy) {
373 case RTCContinualGatheringPolicyGatherOnce:
374 return @"GATHER_ONCE";
375 case RTCContinualGatheringPolicyGatherContinually:
376 return @"GATHER_CONTINUALLY";
377 }
378}
379
hbosf9da44d2016-06-09 03:18:28 -0700380+ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType:
381 (RTCEncryptionKeyType)keyType {
382 switch (keyType) {
383 case RTCEncryptionKeyTypeRSA:
384 return rtc::KT_RSA;
385 case RTCEncryptionKeyTypeECDSA:
386 return rtc::KT_ECDSA;
387 }
388}
389
hjon6d49a8e2016-01-26 13:06:42 -0800390@end