OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 @synthesize iceCandidatePoolSize = _iceCandidatePoolSize; | 36 @synthesize iceCandidatePoolSize = _iceCandidatePoolSize; |
37 @synthesize shouldPruneTurnPorts = _shouldPruneTurnPorts; | 37 @synthesize shouldPruneTurnPorts = _shouldPruneTurnPorts; |
38 @synthesize shouldPresumeWritableWhenFullyRelayed = | 38 @synthesize shouldPresumeWritableWhenFullyRelayed = |
39 _shouldPresumeWritableWhenFullyRelayed; | 39 _shouldPresumeWritableWhenFullyRelayed; |
40 @synthesize iceCheckMinInterval = _iceCheckMinInterval; | 40 @synthesize iceCheckMinInterval = _iceCheckMinInterval; |
41 | 41 |
42 - (instancetype)init { | 42 - (instancetype)init { |
43 // Copy defaults. | 43 // Copy defaults. |
44 webrtc::PeerConnectionInterface::RTCConfiguration config( | 44 webrtc::PeerConnectionInterface::RTCConfiguration config( |
45 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive); | 45 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive); |
46 return [self initWithNativeConfiguration:&config]; | 46 return [self initWithNativeConfiguration:config]; |
47 } | 47 } |
48 | 48 |
49 - (instancetype)initWithNativeConfiguration: | 49 - (instancetype)initWithNativeConfiguration: |
50 (const webrtc::PeerConnectionInterface::RTCConfiguration *)config { | 50 (const webrtc::PeerConnectionInterface::RTCConfiguration &)config { |
51 NSParameterAssert(config); | |
52 if (self = [super init]) { | 51 if (self = [super init]) { |
53 NSMutableArray *iceServers = [NSMutableArray array]; | 52 NSMutableArray *iceServers = [NSMutableArray array]; |
54 for (const webrtc::PeerConnectionInterface::IceServer& server : config->serv
ers) { | 53 for (const webrtc::PeerConnectionInterface::IceServer& server : config.serve
rs) { |
55 RTCIceServer *iceServer = [[RTCIceServer alloc] initWithNativeServer:serve
r]; | 54 RTCIceServer *iceServer = [[RTCIceServer alloc] initWithNativeServer:serve
r]; |
56 [iceServers addObject:iceServer]; | 55 [iceServers addObject:iceServer]; |
57 } | 56 } |
58 _iceServers = iceServers; | 57 _iceServers = iceServers; |
59 _iceTransportPolicy = | 58 _iceTransportPolicy = |
60 [[self class] transportPolicyForTransportsType:config->type]; | 59 [[self class] transportPolicyForTransportsType:config.type]; |
61 _bundlePolicy = | 60 _bundlePolicy = |
62 [[self class] bundlePolicyForNativePolicy:config->bundle_policy]; | 61 [[self class] bundlePolicyForNativePolicy:config.bundle_policy]; |
63 _rtcpMuxPolicy = | 62 _rtcpMuxPolicy = |
64 [[self class] rtcpMuxPolicyForNativePolicy:config->rtcp_mux_policy]; | 63 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; |
65 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: | 64 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: |
66 config->tcp_candidate_policy]; | 65 config.tcp_candidate_policy]; |
67 _candidateNetworkPolicy = [[self class] | 66 _candidateNetworkPolicy = [[self class] |
68 candidateNetworkPolicyForNativePolicy:config->candidate_network_policy]; | 67 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy]; |
69 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = | 68 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = |
70 config->continual_gathering_policy; | 69 config.continual_gathering_policy; |
71 _continualGatheringPolicy = | 70 _continualGatheringPolicy = |
72 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; | 71 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; |
73 _audioJitterBufferMaxPackets = config->audio_jitter_buffer_max_packets; | 72 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; |
74 _audioJitterBufferFastAccelerate = config->audio_jitter_buffer_fast_accelera
te; | 73 _audioJitterBufferFastAccelerate = config.audio_jitter_buffer_fast_accelerat
e; |
75 _iceConnectionReceivingTimeout = config->ice_connection_receiving_timeout; | 74 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; |
76 _iceBackupCandidatePairPingInterval = | 75 _iceBackupCandidatePairPingInterval = |
77 config->ice_backup_candidate_pair_ping_interval; | 76 config.ice_backup_candidate_pair_ping_interval; |
78 _keyType = RTCEncryptionKeyTypeECDSA; | 77 _keyType = RTCEncryptionKeyTypeECDSA; |
79 _iceCandidatePoolSize = config->ice_candidate_pool_size; | 78 _iceCandidatePoolSize = config.ice_candidate_pool_size; |
80 _shouldPruneTurnPorts = config->prune_turn_ports; | 79 _shouldPruneTurnPorts = config.prune_turn_ports; |
81 _shouldPresumeWritableWhenFullyRelayed = | 80 _shouldPresumeWritableWhenFullyRelayed = |
82 config->presume_writable_when_fully_relayed; | 81 config.presume_writable_when_fully_relayed; |
83 if (config->ice_check_min_interval) { | 82 if (config.ice_check_min_interval) { |
84 _iceCheckMinInterval = | 83 _iceCheckMinInterval = |
85 [NSNumber numberWithInt:*config->ice_check_min_interval]; | 84 [NSNumber numberWithInt:*config.ice_check_min_interval]; |
86 } | 85 } |
87 } | 86 } |
88 return self; | 87 return self; |
89 } | 88 } |
90 | 89 |
91 - (NSString *)description { | 90 - (NSString *)description { |
92 return [NSString stringWithFormat: | 91 return [NSString stringWithFormat: |
93 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\
n%d\n%@\n}\n", | 92 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\
n%d\n%@\n}\n", |
94 _iceServers, | 93 _iceServers, |
95 [[self class] stringForTransportPolicy:_iceTransportPolicy], | 94 [[self class] stringForTransportPolicy:_iceTransportPolicy], |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 (RTCEncryptionKeyType)keyType { | 362 (RTCEncryptionKeyType)keyType { |
364 switch (keyType) { | 363 switch (keyType) { |
365 case RTCEncryptionKeyTypeRSA: | 364 case RTCEncryptionKeyTypeRSA: |
366 return rtc::KT_RSA; | 365 return rtc::KT_RSA; |
367 case RTCEncryptionKeyTypeECDSA: | 366 case RTCEncryptionKeyTypeECDSA: |
368 return rtc::KT_ECDSA; | 367 return rtc::KT_ECDSA; |
369 } | 368 } |
370 } | 369 } |
371 | 370 |
372 @end | 371 @end |
OLD | NEW |