blob: faf34d63d0fc10bc340581dd515f450901d0279d [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
Zeke Chinef1140e2017-10-27 15:42:08 -070015#import "RTCConfiguration+Native.h"
tkchin9eeb6242016-04-27 01:54:20 -070016#import "RTCIceServer+Private.h"
Steve Antond295e402017-07-14 16:06:41 -070017#import "RTCIntervalRange+Private.h"
tkchin9eeb6242016-04-27 01:54:20 -070018#import "WebRTC/RTCLogging.h"
tkchinab8f82f2016-01-27 17:50:11 -080019
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "rtc_base/rtccertificategenerator.h"
21#include "rtc_base/sslidentity.h"
hjon6d49a8e2016-01-26 13:06:42 -080022
23@implementation RTCConfiguration
24
25@synthesize iceServers = _iceServers;
26@synthesize iceTransportPolicy = _iceTransportPolicy;
27@synthesize bundlePolicy = _bundlePolicy;
28@synthesize rtcpMuxPolicy = _rtcpMuxPolicy;
29@synthesize tcpCandidatePolicy = _tcpCandidatePolicy;
Honghai Zhang46007ae2016-06-03 16:31:32 -070030@synthesize candidateNetworkPolicy = _candidateNetworkPolicy;
Honghai Zhang3108fc92016-05-11 10:10:39 -070031@synthesize continualGatheringPolicy = _continualGatheringPolicy;
deadbeef2059bb32017-07-26 18:25:43 -070032@synthesize maxIPv6Networks = _maxIPv6Networks;
hjon6d49a8e2016-01-26 13:06:42 -080033@synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets;
hayscc9f95002016-12-05 14:24:32 -080034@synthesize audioJitterBufferFastAccelerate = _audioJitterBufferFastAccelerate;
hjon6d49a8e2016-01-26 13:06:42 -080035@synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout;
36@synthesize iceBackupCandidatePairPingInterval =
37 _iceBackupCandidatePairPingInterval;
tkchinab8f82f2016-01-27 17:50:11 -080038@synthesize keyType = _keyType;
deadbeefbe0c96f2016-05-18 16:20:14 -070039@synthesize iceCandidatePoolSize = _iceCandidatePoolSize;
honghaizaf6b6e02016-07-11 15:09:26 -070040@synthesize shouldPruneTurnPorts = _shouldPruneTurnPorts;
41@synthesize shouldPresumeWritableWhenFullyRelayed =
42 _shouldPresumeWritableWhenFullyRelayed;
skvlada5d94ff2017-02-02 13:02:30 -080043@synthesize iceCheckMinInterval = _iceCheckMinInterval;
Steve Antond295e402017-07-14 16:06:41 -070044@synthesize iceRegatherIntervalRange = _iceRegatherIntervalRange;
Zeke Chinef1140e2017-10-27 15:42:08 -070045@synthesize turnCustomizer = _turnCustomizer;
hjon6d49a8e2016-01-26 13:06:42 -080046
47- (instancetype)init {
jtteh4eeb5372017-04-03 15:06:37 -070048 // Copy defaults.
49 webrtc::PeerConnectionInterface::RTCConfiguration config(
50 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive);
jtteh465faf02017-04-04 14:00:16 -070051 return [self initWithNativeConfiguration:config];
jtteh4eeb5372017-04-03 15:06:37 -070052}
53
54- (instancetype)initWithNativeConfiguration:
jtteh465faf02017-04-04 14:00:16 -070055 (const webrtc::PeerConnectionInterface::RTCConfiguration &)config {
hjon6d49a8e2016-01-26 13:06:42 -080056 if (self = [super init]) {
jtteh4eeb5372017-04-03 15:06:37 -070057 NSMutableArray *iceServers = [NSMutableArray array];
jtteh465faf02017-04-04 14:00:16 -070058 for (const webrtc::PeerConnectionInterface::IceServer& server : config.servers) {
jtteh4eeb5372017-04-03 15:06:37 -070059 RTCIceServer *iceServer = [[RTCIceServer alloc] initWithNativeServer:server];
60 [iceServers addObject:iceServer];
61 }
62 _iceServers = iceServers;
hjon6d49a8e2016-01-26 13:06:42 -080063 _iceTransportPolicy =
jtteh465faf02017-04-04 14:00:16 -070064 [[self class] transportPolicyForTransportsType:config.type];
hjon6d49a8e2016-01-26 13:06:42 -080065 _bundlePolicy =
jtteh465faf02017-04-04 14:00:16 -070066 [[self class] bundlePolicyForNativePolicy:config.bundle_policy];
hjon6d49a8e2016-01-26 13:06:42 -080067 _rtcpMuxPolicy =
jtteh465faf02017-04-04 14:00:16 -070068 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy];
hjon6d49a8e2016-01-26 13:06:42 -080069 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy:
jtteh465faf02017-04-04 14:00:16 -070070 config.tcp_candidate_policy];
Honghai Zhang46007ae2016-06-03 16:31:32 -070071 _candidateNetworkPolicy = [[self class]
jtteh465faf02017-04-04 14:00:16 -070072 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy];
Honghai Zhang3108fc92016-05-11 10:10:39 -070073 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy =
jtteh465faf02017-04-04 14:00:16 -070074 config.continual_gathering_policy;
Honghai Zhang3108fc92016-05-11 10:10:39 -070075 _continualGatheringPolicy =
76 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy];
deadbeef2059bb32017-07-26 18:25:43 -070077 _maxIPv6Networks = config.max_ipv6_networks;
jtteh465faf02017-04-04 14:00:16 -070078 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets;
79 _audioJitterBufferFastAccelerate = config.audio_jitter_buffer_fast_accelerate;
80 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout;
hjon6d49a8e2016-01-26 13:06:42 -080081 _iceBackupCandidatePairPingInterval =
jtteh465faf02017-04-04 14:00:16 -070082 config.ice_backup_candidate_pair_ping_interval;
tkchinab8f82f2016-01-27 17:50:11 -080083 _keyType = RTCEncryptionKeyTypeECDSA;
jtteh465faf02017-04-04 14:00:16 -070084 _iceCandidatePoolSize = config.ice_candidate_pool_size;
85 _shouldPruneTurnPorts = config.prune_turn_ports;
honghaizaf6b6e02016-07-11 15:09:26 -070086 _shouldPresumeWritableWhenFullyRelayed =
jtteh465faf02017-04-04 14:00:16 -070087 config.presume_writable_when_fully_relayed;
88 if (config.ice_check_min_interval) {
skvlada5d94ff2017-02-02 13:02:30 -080089 _iceCheckMinInterval =
jtteh465faf02017-04-04 14:00:16 -070090 [NSNumber numberWithInt:*config.ice_check_min_interval];
skvlada5d94ff2017-02-02 13:02:30 -080091 }
Steve Antond295e402017-07-14 16:06:41 -070092 if (config.ice_regather_interval_range) {
93 const rtc::IntervalRange &nativeIntervalRange = config.ice_regather_interval_range.value();
94 _iceRegatherIntervalRange =
95 [[RTCIntervalRange alloc] initWithNativeIntervalRange:nativeIntervalRange];
96 }
Zeke Chinef1140e2017-10-27 15:42:08 -070097 _turnCustomizer = config.turn_customizer;
hjon6d49a8e2016-01-26 13:06:42 -080098 }
99 return self;
100}
101
102- (NSString *)description {
deadbeef2059bb32017-07-26 18:25:43 -0700103 return
104 [NSString stringWithFormat:
105 @"RTCConfiguration: "
106 @"{\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",
107 _iceServers,
108 [[self class] stringForTransportPolicy:_iceTransportPolicy],
109 [[self class] stringForBundlePolicy:_bundlePolicy],
110 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy],
111 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy],
112 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy],
113 [[self class] stringForContinualGatheringPolicy:_continualGatheringPolicy],
114 _audioJitterBufferMaxPackets,
115 _audioJitterBufferFastAccelerate,
116 _iceConnectionReceivingTimeout,
117 _iceBackupCandidatePairPingInterval,
118 _iceCandidatePoolSize,
119 _shouldPruneTurnPorts,
120 _shouldPresumeWritableWhenFullyRelayed,
121 _iceCheckMinInterval,
122 _iceRegatherIntervalRange,
123 _maxIPv6Networks];
hjon6d49a8e2016-01-26 13:06:42 -0800124}
125
126#pragma mark - Private
127
hbosa73ca562016-05-17 03:28:58 -0700128- (webrtc::PeerConnectionInterface::RTCConfiguration *)
129 createNativeConfiguration {
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200130 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration>
Honghai Zhangf7ddc062016-09-01 15:34:01 -0700131 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration(
132 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive));
hjon6d49a8e2016-01-26 13:06:42 -0800133
134 for (RTCIceServer *iceServer in _iceServers) {
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200135 nativeConfig->servers.push_back(iceServer.nativeServer);
hjon6d49a8e2016-01-26 13:06:42 -0800136 }
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200137 nativeConfig->type =
hjon6d49a8e2016-01-26 13:06:42 -0800138 [[self class] nativeTransportsTypeForTransportPolicy:_iceTransportPolicy];
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200139 nativeConfig->bundle_policy =
hjon6d49a8e2016-01-26 13:06:42 -0800140 [[self class] nativeBundlePolicyForPolicy:_bundlePolicy];
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200141 nativeConfig->rtcp_mux_policy =
hjon6d49a8e2016-01-26 13:06:42 -0800142 [[self class] nativeRtcpMuxPolicyForPolicy:_rtcpMuxPolicy];
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200143 nativeConfig->tcp_candidate_policy =
hjon6d49a8e2016-01-26 13:06:42 -0800144 [[self class] nativeTcpCandidatePolicyForPolicy:_tcpCandidatePolicy];
Honghai Zhang46007ae2016-06-03 16:31:32 -0700145 nativeConfig->candidate_network_policy = [[self class]
146 nativeCandidateNetworkPolicyForPolicy:_candidateNetworkPolicy];
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200147 nativeConfig->continual_gathering_policy = [[self class]
Honghai Zhang3108fc92016-05-11 10:10:39 -0700148 nativeContinualGatheringPolicyForPolicy:_continualGatheringPolicy];
deadbeef2059bb32017-07-26 18:25:43 -0700149 nativeConfig->max_ipv6_networks = _maxIPv6Networks;
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200150 nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets;
hayscc9f95002016-12-05 14:24:32 -0800151 nativeConfig->audio_jitter_buffer_fast_accelerate =
152 _audioJitterBufferFastAccelerate ? true : false;
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200153 nativeConfig->ice_connection_receiving_timeout =
hjon6d49a8e2016-01-26 13:06:42 -0800154 _iceConnectionReceivingTimeout;
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200155 nativeConfig->ice_backup_candidate_pair_ping_interval =
hjon6d49a8e2016-01-26 13:06:42 -0800156 _iceBackupCandidatePairPingInterval;
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200157 rtc::KeyType keyType =
158 [[self class] nativeEncryptionKeyTypeForKeyType:_keyType];
159 // Generate non-default certificate.
160 if (keyType != rtc::KT_DEFAULT) {
161 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
162 rtc::RTCCertificateGenerator::GenerateCertificate(
163 rtc::KeyParams(keyType), rtc::Optional<uint64_t>());
164 if (!certificate) {
hbosa73ca562016-05-17 03:28:58 -0700165 RTCLogError(@"Failed to generate certificate.");
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200166 return nullptr;
tkchinab8f82f2016-01-27 17:50:11 -0800167 }
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200168 nativeConfig->certificates.push_back(certificate);
tkchinab8f82f2016-01-27 17:50:11 -0800169 }
deadbeefbe0c96f2016-05-18 16:20:14 -0700170 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize;
honghaizaf6b6e02016-07-11 15:09:26 -0700171 nativeConfig->prune_turn_ports = _shouldPruneTurnPorts ? true : false;
Taylor Brandstettere9851112016-07-01 11:11:13 -0700172 nativeConfig->presume_writable_when_fully_relayed =
honghaizaf6b6e02016-07-11 15:09:26 -0700173 _shouldPresumeWritableWhenFullyRelayed ? true : false;
skvlada5d94ff2017-02-02 13:02:30 -0800174 if (_iceCheckMinInterval != nil) {
175 nativeConfig->ice_check_min_interval =
176 rtc::Optional<int>(_iceCheckMinInterval.intValue);
177 }
Steve Antond295e402017-07-14 16:06:41 -0700178 if (_iceRegatherIntervalRange != nil) {
179 std::unique_ptr<rtc::IntervalRange> nativeIntervalRange(
180 _iceRegatherIntervalRange.nativeIntervalRange);
181 nativeConfig->ice_regather_interval_range =
182 rtc::Optional<rtc::IntervalRange>(*nativeIntervalRange);
183 }
Zeke Chinef1140e2017-10-27 15:42:08 -0700184 if (_turnCustomizer) {
185 nativeConfig->turn_customizer = _turnCustomizer;
186 }
Henrik Boströme06c2dd2016-05-13 13:50:38 +0200187 return nativeConfig.release();
hjon6d49a8e2016-01-26 13:06:42 -0800188}
189
hjon6d49a8e2016-01-26 13:06:42 -0800190+ (webrtc::PeerConnectionInterface::IceTransportsType)
191 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy {
192 switch (policy) {
193 case RTCIceTransportPolicyNone:
194 return webrtc::PeerConnectionInterface::kNone;
195 case RTCIceTransportPolicyRelay:
196 return webrtc::PeerConnectionInterface::kRelay;
197 case RTCIceTransportPolicyNoHost:
198 return webrtc::PeerConnectionInterface::kNoHost;
199 case RTCIceTransportPolicyAll:
200 return webrtc::PeerConnectionInterface::kAll;
201 }
202}
203
204+ (RTCIceTransportPolicy)transportPolicyForTransportsType:
205 (webrtc::PeerConnectionInterface::IceTransportsType)nativeType {
206 switch (nativeType) {
207 case webrtc::PeerConnectionInterface::kNone:
208 return RTCIceTransportPolicyNone;
209 case webrtc::PeerConnectionInterface::kRelay:
210 return RTCIceTransportPolicyRelay;
211 case webrtc::PeerConnectionInterface::kNoHost:
212 return RTCIceTransportPolicyNoHost;
213 case webrtc::PeerConnectionInterface::kAll:
214 return RTCIceTransportPolicyAll;
215 }
216}
217
218+ (NSString *)stringForTransportPolicy:(RTCIceTransportPolicy)policy {
219 switch (policy) {
220 case RTCIceTransportPolicyNone:
221 return @"NONE";
222 case RTCIceTransportPolicyRelay:
223 return @"RELAY";
224 case RTCIceTransportPolicyNoHost:
225 return @"NO_HOST";
226 case RTCIceTransportPolicyAll:
227 return @"ALL";
228 }
229}
230
231+ (webrtc::PeerConnectionInterface::BundlePolicy)nativeBundlePolicyForPolicy:
232 (RTCBundlePolicy)policy {
233 switch (policy) {
234 case RTCBundlePolicyBalanced:
235 return webrtc::PeerConnectionInterface::kBundlePolicyBalanced;
236 case RTCBundlePolicyMaxCompat:
237 return webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat;
238 case RTCBundlePolicyMaxBundle:
239 return webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle;
240 }
241}
242
243+ (RTCBundlePolicy)bundlePolicyForNativePolicy:
244 (webrtc::PeerConnectionInterface::BundlePolicy)nativePolicy {
245 switch (nativePolicy) {
246 case webrtc::PeerConnectionInterface::kBundlePolicyBalanced:
247 return RTCBundlePolicyBalanced;
248 case webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat:
249 return RTCBundlePolicyMaxCompat;
250 case webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle:
251 return RTCBundlePolicyMaxBundle;
252 }
253}
254
255+ (NSString *)stringForBundlePolicy:(RTCBundlePolicy)policy {
256 switch (policy) {
257 case RTCBundlePolicyBalanced:
258 return @"BALANCED";
259 case RTCBundlePolicyMaxCompat:
260 return @"MAX_COMPAT";
261 case RTCBundlePolicyMaxBundle:
262 return @"MAX_BUNDLE";
263 }
264}
265
266+ (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeRtcpMuxPolicyForPolicy:
267 (RTCRtcpMuxPolicy)policy {
268 switch (policy) {
269 case RTCRtcpMuxPolicyNegotiate:
270 return webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate;
271 case RTCRtcpMuxPolicyRequire:
272 return webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire;
273 }
274}
275
276+ (RTCRtcpMuxPolicy)rtcpMuxPolicyForNativePolicy:
277 (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativePolicy {
278 switch (nativePolicy) {
279 case webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate:
280 return RTCRtcpMuxPolicyNegotiate;
281 case webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire:
282 return RTCRtcpMuxPolicyRequire;
283 }
284}
285
286+ (NSString *)stringForRtcpMuxPolicy:(RTCRtcpMuxPolicy)policy {
287 switch (policy) {
288 case RTCRtcpMuxPolicyNegotiate:
289 return @"NEGOTIATE";
290 case RTCRtcpMuxPolicyRequire:
291 return @"REQUIRE";
292 }
293}
294
295+ (webrtc::PeerConnectionInterface::TcpCandidatePolicy)
296 nativeTcpCandidatePolicyForPolicy:(RTCTcpCandidatePolicy)policy {
297 switch (policy) {
298 case RTCTcpCandidatePolicyEnabled:
299 return webrtc::PeerConnectionInterface::kTcpCandidatePolicyEnabled;
300 case RTCTcpCandidatePolicyDisabled:
301 return webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled;
302 }
303}
304
Honghai Zhang46007ae2016-06-03 16:31:32 -0700305+ (webrtc::PeerConnectionInterface::CandidateNetworkPolicy)
306 nativeCandidateNetworkPolicyForPolicy:(RTCCandidateNetworkPolicy)policy {
307 switch (policy) {
308 case RTCCandidateNetworkPolicyAll:
309 return webrtc::PeerConnectionInterface::kCandidateNetworkPolicyAll;
310 case RTCCandidateNetworkPolicyLowCost:
311 return webrtc::PeerConnectionInterface::kCandidateNetworkPolicyLowCost;
312 }
313}
314
hjon6d49a8e2016-01-26 13:06:42 -0800315+ (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativePolicy:
316 (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativePolicy {
317 switch (nativePolicy) {
318 case webrtc::PeerConnectionInterface::kTcpCandidatePolicyEnabled:
319 return RTCTcpCandidatePolicyEnabled;
320 case webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled:
321 return RTCTcpCandidatePolicyDisabled;
322 }
323}
324
325+ (NSString *)stringForTcpCandidatePolicy:(RTCTcpCandidatePolicy)policy {
326 switch (policy) {
327 case RTCTcpCandidatePolicyEnabled:
328 return @"TCP_ENABLED";
329 case RTCTcpCandidatePolicyDisabled:
330 return @"TCP_DISABLED";
331 }
332}
333
Honghai Zhang46007ae2016-06-03 16:31:32 -0700334+ (RTCCandidateNetworkPolicy)candidateNetworkPolicyForNativePolicy:
335 (webrtc::PeerConnectionInterface::CandidateNetworkPolicy)nativePolicy {
336 switch (nativePolicy) {
337 case webrtc::PeerConnectionInterface::kCandidateNetworkPolicyAll:
338 return RTCCandidateNetworkPolicyAll;
339 case webrtc::PeerConnectionInterface::kCandidateNetworkPolicyLowCost:
340 return RTCCandidateNetworkPolicyLowCost;
341 }
342}
343
344+ (NSString *)stringForCandidateNetworkPolicy:
345 (RTCCandidateNetworkPolicy)policy {
346 switch (policy) {
347 case RTCCandidateNetworkPolicyAll:
348 return @"CANDIDATE_ALL_NETWORKS";
349 case RTCCandidateNetworkPolicyLowCost:
350 return @"CANDIDATE_LOW_COST_NETWORKS";
351 }
352}
353
Honghai Zhang3108fc92016-05-11 10:10:39 -0700354+ (webrtc::PeerConnectionInterface::ContinualGatheringPolicy)
355 nativeContinualGatheringPolicyForPolicy:
356 (RTCContinualGatheringPolicy)policy {
357 switch (policy) {
358 case RTCContinualGatheringPolicyGatherOnce:
359 return webrtc::PeerConnectionInterface::GATHER_ONCE;
360 case RTCContinualGatheringPolicyGatherContinually:
361 return webrtc::PeerConnectionInterface::GATHER_CONTINUALLY;
362 }
363}
364
365+ (RTCContinualGatheringPolicy)continualGatheringPolicyForNativePolicy:
366 (webrtc::PeerConnectionInterface::ContinualGatheringPolicy)nativePolicy {
367 switch (nativePolicy) {
368 case webrtc::PeerConnectionInterface::GATHER_ONCE:
369 return RTCContinualGatheringPolicyGatherOnce;
370 case webrtc::PeerConnectionInterface::GATHER_CONTINUALLY:
371 return RTCContinualGatheringPolicyGatherContinually;
372 }
373}
374
375+ (NSString *)stringForContinualGatheringPolicy:
376 (RTCContinualGatheringPolicy)policy {
377 switch (policy) {
378 case RTCContinualGatheringPolicyGatherOnce:
379 return @"GATHER_ONCE";
380 case RTCContinualGatheringPolicyGatherContinually:
381 return @"GATHER_CONTINUALLY";
382 }
383}
384
hbosf9da44d2016-06-09 03:18:28 -0700385+ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType:
386 (RTCEncryptionKeyType)keyType {
387 switch (keyType) {
388 case RTCEncryptionKeyTypeRSA:
389 return rtc::KT_RSA;
390 case RTCEncryptionKeyTypeECDSA:
391 return rtc::KT_ECDSA;
392 }
393}
394
hjon6d49a8e2016-01-26 13:06:42 -0800395@end