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 15 matching lines...) Expand all Loading... |
26 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; | 26 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; |
27 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; | 27 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; |
28 @synthesize candidateNetworkPolicy = _candidateNetworkPolicy; | 28 @synthesize candidateNetworkPolicy = _candidateNetworkPolicy; |
29 @synthesize continualGatheringPolicy = _continualGatheringPolicy; | 29 @synthesize continualGatheringPolicy = _continualGatheringPolicy; |
30 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; | 30 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; |
31 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; | 31 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; |
32 @synthesize iceBackupCandidatePairPingInterval = | 32 @synthesize iceBackupCandidatePairPingInterval = |
33 _iceBackupCandidatePairPingInterval; | 33 _iceBackupCandidatePairPingInterval; |
34 @synthesize keyType = _keyType; | 34 @synthesize keyType = _keyType; |
35 @synthesize iceCandidatePoolSize = _iceCandidatePoolSize; | 35 @synthesize iceCandidatePoolSize = _iceCandidatePoolSize; |
| 36 @synthesize pruneTurnPorts = _pruneTurnPorts; |
36 @synthesize presumeWritableWhenFullyRelayed = _presumeWritableWhenFullyRelayed; | 37 @synthesize presumeWritableWhenFullyRelayed = _presumeWritableWhenFullyRelayed; |
37 | 38 |
38 - (instancetype)init { | 39 - (instancetype)init { |
39 if (self = [super init]) { | 40 if (self = [super init]) { |
40 _iceServers = [NSMutableArray array]; | 41 _iceServers = [NSMutableArray array]; |
41 // Copy defaults. | 42 // Copy defaults. |
42 webrtc::PeerConnectionInterface::RTCConfiguration config; | 43 webrtc::PeerConnectionInterface::RTCConfiguration config; |
43 _iceTransportPolicy = | 44 _iceTransportPolicy = |
44 [[self class] transportPolicyForTransportsType:config.type]; | 45 [[self class] transportPolicyForTransportsType:config.type]; |
45 _bundlePolicy = | 46 _bundlePolicy = |
46 [[self class] bundlePolicyForNativePolicy:config.bundle_policy]; | 47 [[self class] bundlePolicyForNativePolicy:config.bundle_policy]; |
47 _rtcpMuxPolicy = | 48 _rtcpMuxPolicy = |
48 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; | 49 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; |
49 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: | 50 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: |
50 config.tcp_candidate_policy]; | 51 config.tcp_candidate_policy]; |
51 _candidateNetworkPolicy = [[self class] | 52 _candidateNetworkPolicy = [[self class] |
52 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy]; | 53 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy]; |
53 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = | 54 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = |
54 config.continual_gathering_policy; | 55 config.continual_gathering_policy; |
55 _continualGatheringPolicy = | 56 _continualGatheringPolicy = |
56 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; | 57 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; |
57 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; | 58 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; |
58 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; | 59 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; |
59 _iceBackupCandidatePairPingInterval = | 60 _iceBackupCandidatePairPingInterval = |
60 config.ice_backup_candidate_pair_ping_interval; | 61 config.ice_backup_candidate_pair_ping_interval; |
61 _keyType = RTCEncryptionKeyTypeECDSA; | 62 _keyType = RTCEncryptionKeyTypeECDSA; |
62 _iceCandidatePoolSize = config.ice_candidate_pool_size; | 63 _iceCandidatePoolSize = config.ice_candidate_pool_size; |
| 64 _pruneTurnPorts = config.prune_turn_ports; |
63 _presumeWritableWhenFullyRelayed = | 65 _presumeWritableWhenFullyRelayed = |
64 config.presume_writable_when_fully_relayed; | 66 config.presume_writable_when_fully_relayed; |
65 } | 67 } |
66 return self; | 68 return self; |
67 } | 69 } |
68 | 70 |
69 - (NSString *)description { | 71 - (NSString *)description { |
70 return [NSString stringWithFormat: | 72 return [NSString stringWithFormat: |
71 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n}\n
", | 73 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\
n}\n", |
72 _iceServers, | 74 _iceServers, |
73 [[self class] stringForTransportPolicy:_iceTransportPolicy], | 75 [[self class] stringForTransportPolicy:_iceTransportPolicy], |
74 [[self class] stringForBundlePolicy:_bundlePolicy], | 76 [[self class] stringForBundlePolicy:_bundlePolicy], |
75 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], | 77 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], |
76 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], | 78 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], |
77 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy], | 79 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy], |
78 [[self class] | 80 [[self class] |
79 stringForContinualGatheringPolicy:_continualGatheringPolicy], | 81 stringForContinualGatheringPolicy:_continualGatheringPolicy], |
80 _audioJitterBufferMaxPackets, | 82 _audioJitterBufferMaxPackets, |
81 _iceConnectionReceivingTimeout, | 83 _iceConnectionReceivingTimeout, |
82 _iceBackupCandidatePairPingInterval, | 84 _iceBackupCandidatePairPingInterval, |
83 _iceCandidatePoolSize, | 85 _iceCandidatePoolSize, |
| 86 _pruneTurnPorts, |
84 _presumeWritableWhenFullyRelayed]; | 87 _presumeWritableWhenFullyRelayed]; |
85 } | 88 } |
86 | 89 |
87 #pragma mark - Private | 90 #pragma mark - Private |
88 | 91 |
89 - (webrtc::PeerConnectionInterface::RTCConfiguration *) | 92 - (webrtc::PeerConnectionInterface::RTCConfiguration *) |
90 createNativeConfiguration { | 93 createNativeConfiguration { |
91 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> | 94 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> |
92 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); | 95 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); |
93 | 96 |
(...skipping 24 matching lines...) Expand all Loading... |
118 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 121 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
119 rtc::RTCCertificateGenerator::GenerateCertificate( | 122 rtc::RTCCertificateGenerator::GenerateCertificate( |
120 rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); | 123 rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); |
121 if (!certificate) { | 124 if (!certificate) { |
122 RTCLogError(@"Failed to generate certificate."); | 125 RTCLogError(@"Failed to generate certificate."); |
123 return nullptr; | 126 return nullptr; |
124 } | 127 } |
125 nativeConfig->certificates.push_back(certificate); | 128 nativeConfig->certificates.push_back(certificate); |
126 } | 129 } |
127 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize; | 130 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize; |
| 131 nativeConfig->prune_turn_ports = _pruneTurnPorts; |
128 nativeConfig->presume_writable_when_fully_relayed = | 132 nativeConfig->presume_writable_when_fully_relayed = |
129 _presumeWritableWhenFullyRelayed; | 133 _presumeWritableWhenFullyRelayed; |
130 | 134 |
131 return nativeConfig.release(); | 135 return nativeConfig.release(); |
132 } | 136 } |
133 | 137 |
134 + (webrtc::PeerConnectionInterface::IceTransportsType) | 138 + (webrtc::PeerConnectionInterface::IceTransportsType) |
135 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { | 139 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { |
136 switch (policy) { | 140 switch (policy) { |
137 case RTCIceTransportPolicyNone: | 141 case RTCIceTransportPolicyNone: |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 (RTCEncryptionKeyType)keyType { | 334 (RTCEncryptionKeyType)keyType { |
331 switch (keyType) { | 335 switch (keyType) { |
332 case RTCEncryptionKeyTypeRSA: | 336 case RTCEncryptionKeyTypeRSA: |
333 return rtc::KT_RSA; | 337 return rtc::KT_RSA; |
334 case RTCEncryptionKeyTypeECDSA: | 338 case RTCEncryptionKeyTypeECDSA: |
335 return rtc::KT_ECDSA; | 339 return rtc::KT_ECDSA; |
336 } | 340 } |
337 } | 341 } |
338 | 342 |
339 @end | 343 @end |
OLD | NEW |