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 19 matching lines...) Expand all Loading... |
30 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; | 30 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; |
31 @synthesize audioJitterBufferFastAccelerate = _audioJitterBufferFastAccelerate; | 31 @synthesize audioJitterBufferFastAccelerate = _audioJitterBufferFastAccelerate; |
32 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; | 32 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; |
33 @synthesize iceBackupCandidatePairPingInterval = | 33 @synthesize iceBackupCandidatePairPingInterval = |
34 _iceBackupCandidatePairPingInterval; | 34 _iceBackupCandidatePairPingInterval; |
35 @synthesize keyType = _keyType; | 35 @synthesize keyType = _keyType; |
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 | 41 |
41 - (instancetype)init { | 42 - (instancetype)init { |
42 if (self = [super init]) { | 43 if (self = [super init]) { |
43 _iceServers = [NSMutableArray array]; | 44 _iceServers = [NSMutableArray array]; |
44 // Copy defaults. | 45 // Copy defaults. |
45 webrtc::PeerConnectionInterface::RTCConfiguration config( | 46 webrtc::PeerConnectionInterface::RTCConfiguration config( |
46 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive); | 47 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive); |
47 _iceTransportPolicy = | 48 _iceTransportPolicy = |
48 [[self class] transportPolicyForTransportsType:config.type]; | 49 [[self class] transportPolicyForTransportsType:config.type]; |
49 _bundlePolicy = | 50 _bundlePolicy = |
(...skipping 11 matching lines...) Expand all Loading... |
61 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; | 62 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; |
62 _audioJitterBufferFastAccelerate = config.audio_jitter_buffer_fast_accelerat
e; | 63 _audioJitterBufferFastAccelerate = config.audio_jitter_buffer_fast_accelerat
e; |
63 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; | 64 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; |
64 _iceBackupCandidatePairPingInterval = | 65 _iceBackupCandidatePairPingInterval = |
65 config.ice_backup_candidate_pair_ping_interval; | 66 config.ice_backup_candidate_pair_ping_interval; |
66 _keyType = RTCEncryptionKeyTypeECDSA; | 67 _keyType = RTCEncryptionKeyTypeECDSA; |
67 _iceCandidatePoolSize = config.ice_candidate_pool_size; | 68 _iceCandidatePoolSize = config.ice_candidate_pool_size; |
68 _shouldPruneTurnPorts = config.prune_turn_ports; | 69 _shouldPruneTurnPorts = config.prune_turn_ports; |
69 _shouldPresumeWritableWhenFullyRelayed = | 70 _shouldPresumeWritableWhenFullyRelayed = |
70 config.presume_writable_when_fully_relayed; | 71 config.presume_writable_when_fully_relayed; |
| 72 if (config.ice_check_min_interval) { |
| 73 _iceCheckMinInterval = |
| 74 [NSNumber numberWithInt:*config.ice_check_min_interval]; |
| 75 } |
71 } | 76 } |
72 return self; | 77 return self; |
73 } | 78 } |
74 | 79 |
75 - (NSString *)description { | 80 - (NSString *)description { |
76 return [NSString stringWithFormat: | 81 return [NSString stringWithFormat: |
77 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\
n%d\n}\n", | 82 @"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", |
78 _iceServers, | 83 _iceServers, |
79 [[self class] stringForTransportPolicy:_iceTransportPolicy], | 84 [[self class] stringForTransportPolicy:_iceTransportPolicy], |
80 [[self class] stringForBundlePolicy:_bundlePolicy], | 85 [[self class] stringForBundlePolicy:_bundlePolicy], |
81 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], | 86 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], |
82 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], | 87 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], |
83 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy], | 88 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy], |
84 [[self class] | 89 [[self class] |
85 stringForContinualGatheringPolicy:_continualGatheringPolicy], | 90 stringForContinualGatheringPolicy:_continualGatheringPolicy], |
86 _audioJitterBufferMaxPackets, | 91 _audioJitterBufferMaxPackets, |
87 _audioJitterBufferFastAccelerate, | 92 _audioJitterBufferFastAccelerate, |
88 _iceConnectionReceivingTimeout, | 93 _iceConnectionReceivingTimeout, |
89 _iceBackupCandidatePairPingInterval, | 94 _iceBackupCandidatePairPingInterval, |
90 _iceCandidatePoolSize, | 95 _iceCandidatePoolSize, |
91 _shouldPruneTurnPorts, | 96 _shouldPruneTurnPorts, |
92 _shouldPresumeWritableWhenFullyRelayed]; | 97 _shouldPresumeWritableWhenFullyRelayed, |
| 98 _iceCheckMinInterval]; |
93 } | 99 } |
94 | 100 |
95 #pragma mark - Private | 101 #pragma mark - Private |
96 | 102 |
97 - (webrtc::PeerConnectionInterface::RTCConfiguration *) | 103 - (webrtc::PeerConnectionInterface::RTCConfiguration *) |
98 createNativeConfiguration { | 104 createNativeConfiguration { |
99 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> | 105 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> |
100 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration( | 106 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration( |
101 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive)); | 107 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive)); |
102 | 108 |
(...skipping 29 matching lines...) Expand all Loading... |
132 if (!certificate) { | 138 if (!certificate) { |
133 RTCLogError(@"Failed to generate certificate."); | 139 RTCLogError(@"Failed to generate certificate."); |
134 return nullptr; | 140 return nullptr; |
135 } | 141 } |
136 nativeConfig->certificates.push_back(certificate); | 142 nativeConfig->certificates.push_back(certificate); |
137 } | 143 } |
138 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize; | 144 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize; |
139 nativeConfig->prune_turn_ports = _shouldPruneTurnPorts ? true : false; | 145 nativeConfig->prune_turn_ports = _shouldPruneTurnPorts ? true : false; |
140 nativeConfig->presume_writable_when_fully_relayed = | 146 nativeConfig->presume_writable_when_fully_relayed = |
141 _shouldPresumeWritableWhenFullyRelayed ? true : false; | 147 _shouldPresumeWritableWhenFullyRelayed ? true : false; |
| 148 if (_iceCheckMinInterval != nil) { |
| 149 nativeConfig->ice_check_min_interval = |
| 150 rtc::Optional<int>(_iceCheckMinInterval.intValue); |
| 151 } |
142 | 152 |
143 return nativeConfig.release(); | 153 return nativeConfig.release(); |
144 } | 154 } |
145 | 155 |
146 + (webrtc::PeerConnectionInterface::IceTransportsType) | 156 + (webrtc::PeerConnectionInterface::IceTransportsType) |
147 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { | 157 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { |
148 switch (policy) { | 158 switch (policy) { |
149 case RTCIceTransportPolicyNone: | 159 case RTCIceTransportPolicyNone: |
150 return webrtc::PeerConnectionInterface::kNone; | 160 return webrtc::PeerConnectionInterface::kNone; |
151 case RTCIceTransportPolicyRelay: | 161 case RTCIceTransportPolicyRelay: |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 (RTCEncryptionKeyType)keyType { | 352 (RTCEncryptionKeyType)keyType { |
343 switch (keyType) { | 353 switch (keyType) { |
344 case RTCEncryptionKeyTypeRSA: | 354 case RTCEncryptionKeyTypeRSA: |
345 return rtc::KT_RSA; | 355 return rtc::KT_RSA; |
346 case RTCEncryptionKeyTypeECDSA: | 356 case RTCEncryptionKeyTypeECDSA: |
347 return rtc::KT_ECDSA; | 357 return rtc::KT_ECDSA; |
348 } | 358 } |
349 } | 359 } |
350 | 360 |
351 @end | 361 @end |
OLD | NEW |