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 13 matching lines...) Expand all Loading... |
24 @synthesize iceTransportPolicy = _iceTransportPolicy; | 24 @synthesize iceTransportPolicy = _iceTransportPolicy; |
25 @synthesize bundlePolicy = _bundlePolicy; | 25 @synthesize bundlePolicy = _bundlePolicy; |
26 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; | 26 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; |
27 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; | 27 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; |
28 @synthesize continualGatheringPolicy = _continualGatheringPolicy; | 28 @synthesize continualGatheringPolicy = _continualGatheringPolicy; |
29 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; | 29 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; |
30 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; | 30 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; |
31 @synthesize iceBackupCandidatePairPingInterval = | 31 @synthesize iceBackupCandidatePairPingInterval = |
32 _iceBackupCandidatePairPingInterval; | 32 _iceBackupCandidatePairPingInterval; |
33 @synthesize keyType = _keyType; | 33 @synthesize keyType = _keyType; |
| 34 @synthesize iceCandidatePoolSize = _iceCandidatePoolSize; |
34 | 35 |
35 - (instancetype)init { | 36 - (instancetype)init { |
36 if (self = [super init]) { | 37 if (self = [super init]) { |
37 _iceServers = [NSMutableArray array]; | 38 _iceServers = [NSMutableArray array]; |
38 // Copy defaults. | 39 // Copy defaults. |
39 webrtc::PeerConnectionInterface::RTCConfiguration config; | 40 webrtc::PeerConnectionInterface::RTCConfiguration config; |
40 _iceTransportPolicy = | 41 _iceTransportPolicy = |
41 [[self class] transportPolicyForTransportsType:config.type]; | 42 [[self class] transportPolicyForTransportsType:config.type]; |
42 _bundlePolicy = | 43 _bundlePolicy = |
43 [[self class] bundlePolicyForNativePolicy:config.bundle_policy]; | 44 [[self class] bundlePolicyForNativePolicy:config.bundle_policy]; |
44 _rtcpMuxPolicy = | 45 _rtcpMuxPolicy = |
45 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; | 46 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; |
46 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: | 47 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: |
47 config.tcp_candidate_policy]; | 48 config.tcp_candidate_policy]; |
48 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = | 49 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = |
49 config.continual_gathering_policy; | 50 config.continual_gathering_policy; |
50 _continualGatheringPolicy = | 51 _continualGatheringPolicy = |
51 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; | 52 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; |
52 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; | 53 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; |
53 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; | 54 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; |
54 _iceBackupCandidatePairPingInterval = | 55 _iceBackupCandidatePairPingInterval = |
55 config.ice_backup_candidate_pair_ping_interval; | 56 config.ice_backup_candidate_pair_ping_interval; |
56 _keyType = RTCEncryptionKeyTypeECDSA; | 57 _keyType = RTCEncryptionKeyTypeECDSA; |
| 58 _iceCandidatePoolSize = config.ice_candidate_pool_size; |
57 } | 59 } |
58 return self; | 60 return self; |
59 } | 61 } |
60 | 62 |
61 - (NSString *)description { | 63 - (NSString *)description { |
62 return [NSString stringWithFormat: | 64 return [NSString stringWithFormat: |
63 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n}\n", | 65 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n}\n", |
64 _iceServers, | 66 _iceServers, |
65 [[self class] stringForTransportPolicy:_iceTransportPolicy], | 67 [[self class] stringForTransportPolicy:_iceTransportPolicy], |
66 [[self class] stringForBundlePolicy:_bundlePolicy], | 68 [[self class] stringForBundlePolicy:_bundlePolicy], |
67 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], | 69 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], |
68 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], | 70 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], |
69 [[self class] | 71 [[self class] |
70 stringForContinualGatheringPolicy:_continualGatheringPolicy], | 72 stringForContinualGatheringPolicy:_continualGatheringPolicy], |
71 _audioJitterBufferMaxPackets, | 73 _audioJitterBufferMaxPackets, |
72 _iceConnectionReceivingTimeout, | 74 _iceConnectionReceivingTimeout, |
73 _iceBackupCandidatePairPingInterval]; | 75 _iceBackupCandidatePairPingInterval, |
| 76 _iceCandidatePoolSize]; |
74 } | 77 } |
75 | 78 |
76 #pragma mark - Private | 79 #pragma mark - Private |
77 | 80 |
78 - (webrtc::PeerConnectionInterface::RTCConfiguration *) | 81 - (webrtc::PeerConnectionInterface::RTCConfiguration *) |
79 createNativeConfiguration { | 82 createNativeConfiguration { |
80 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> | 83 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> |
81 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); | 84 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); |
82 | 85 |
83 for (RTCIceServer *iceServer in _iceServers) { | 86 for (RTCIceServer *iceServer in _iceServers) { |
(...skipping 20 matching lines...) Expand all Loading... |
104 if (keyType != rtc::KT_DEFAULT) { | 107 if (keyType != rtc::KT_DEFAULT) { |
105 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 108 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
106 rtc::RTCCertificateGenerator::GenerateCertificate( | 109 rtc::RTCCertificateGenerator::GenerateCertificate( |
107 rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); | 110 rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); |
108 if (!certificate) { | 111 if (!certificate) { |
109 RTCLogError(@"Failed to generate certificate."); | 112 RTCLogError(@"Failed to generate certificate."); |
110 return nullptr; | 113 return nullptr; |
111 } | 114 } |
112 nativeConfig->certificates.push_back(certificate); | 115 nativeConfig->certificates.push_back(certificate); |
113 } | 116 } |
| 117 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize; |
114 | 118 |
115 return nativeConfig.release(); | 119 return nativeConfig.release(); |
116 } | 120 } |
117 | 121 |
118 + (webrtc::PeerConnectionInterface::IceTransportsType) | 122 + (webrtc::PeerConnectionInterface::IceTransportsType) |
119 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { | 123 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { |
120 switch (policy) { | 124 switch (policy) { |
121 case RTCIceTransportPolicyNone: | 125 case RTCIceTransportPolicyNone: |
122 return webrtc::PeerConnectionInterface::kNone; | 126 return webrtc::PeerConnectionInterface::kNone; |
123 case RTCIceTransportPolicyRelay: | 127 case RTCIceTransportPolicyRelay: |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 (RTCContinualGatheringPolicy)policy { | 288 (RTCContinualGatheringPolicy)policy { |
285 switch (policy) { | 289 switch (policy) { |
286 case RTCContinualGatheringPolicyGatherOnce: | 290 case RTCContinualGatheringPolicyGatherOnce: |
287 return @"GATHER_ONCE"; | 291 return @"GATHER_ONCE"; |
288 case RTCContinualGatheringPolicyGatherContinually: | 292 case RTCContinualGatheringPolicyGatherContinually: |
289 return @"GATHER_CONTINUALLY"; | 293 return @"GATHER_CONTINUALLY"; |
290 } | 294 } |
291 } | 295 } |
292 | 296 |
293 @end | 297 @end |
OLD | NEW |