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 shouldPruneTurnPorts = _shouldPruneTurnPorts; |
37 @synthesize presumeWritableWhenFullyRelayed = _presumeWritableWhenFullyRelayed; | 37 @synthesize shouldPresumeWritableWhenFullyRelayed = |
38 _shouldPresumeWritableWhenFullyRelayed; | |
38 | 39 |
39 - (instancetype)init { | 40 - (instancetype)init { |
40 if (self = [super init]) { | 41 if (self = [super init]) { |
41 _iceServers = [NSMutableArray array]; | 42 _iceServers = [NSMutableArray array]; |
42 // Copy defaults. | 43 // Copy defaults. |
43 webrtc::PeerConnectionInterface::RTCConfiguration config; | 44 webrtc::PeerConnectionInterface::RTCConfiguration config; |
44 _iceTransportPolicy = | 45 _iceTransportPolicy = |
45 [[self class] transportPolicyForTransportsType:config.type]; | 46 [[self class] transportPolicyForTransportsType:config.type]; |
46 _bundlePolicy = | 47 _bundlePolicy = |
47 [[self class] bundlePolicyForNativePolicy:config.bundle_policy]; | 48 [[self class] bundlePolicyForNativePolicy:config.bundle_policy]; |
48 _rtcpMuxPolicy = | 49 _rtcpMuxPolicy = |
49 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; | 50 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; |
50 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: | 51 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: |
51 config.tcp_candidate_policy]; | 52 config.tcp_candidate_policy]; |
52 _candidateNetworkPolicy = [[self class] | 53 _candidateNetworkPolicy = [[self class] |
53 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy]; | 54 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy]; |
54 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = | 55 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = |
55 config.continual_gathering_policy; | 56 config.continual_gathering_policy; |
56 _continualGatheringPolicy = | 57 _continualGatheringPolicy = |
57 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; | 58 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; |
58 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; | 59 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; |
59 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; | 60 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; |
60 _iceBackupCandidatePairPingInterval = | 61 _iceBackupCandidatePairPingInterval = |
61 config.ice_backup_candidate_pair_ping_interval; | 62 config.ice_backup_candidate_pair_ping_interval; |
62 _keyType = RTCEncryptionKeyTypeECDSA; | 63 _keyType = RTCEncryptionKeyTypeECDSA; |
63 _iceCandidatePoolSize = config.ice_candidate_pool_size; | 64 _iceCandidatePoolSize = config.ice_candidate_pool_size; |
64 _pruneTurnPorts = config.prune_turn_ports; | 65 _shouldPruneTurnPorts = config.prune_turn_ports; |
65 _presumeWritableWhenFullyRelayed = | 66 _shouldPresumeWritableWhenFullyRelayed = |
66 config.presume_writable_when_fully_relayed; | 67 config.presume_writable_when_fully_relayed; |
67 } | 68 } |
68 return self; | 69 return self; |
69 } | 70 } |
70 | 71 |
71 - (NSString *)description { | 72 - (NSString *)description { |
72 return [NSString stringWithFormat: | 73 return [NSString stringWithFormat: |
73 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\ n}\n", | 74 @"RTCConfiguration: {\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\ n}\n", |
74 _iceServers, | 75 _iceServers, |
75 [[self class] stringForTransportPolicy:_iceTransportPolicy], | 76 [[self class] stringForTransportPolicy:_iceTransportPolicy], |
76 [[self class] stringForBundlePolicy:_bundlePolicy], | 77 [[self class] stringForBundlePolicy:_bundlePolicy], |
77 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], | 78 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], |
78 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], | 79 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], |
79 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy], | 80 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy], |
80 [[self class] | 81 [[self class] |
81 stringForContinualGatheringPolicy:_continualGatheringPolicy], | 82 stringForContinualGatheringPolicy:_continualGatheringPolicy], |
82 _audioJitterBufferMaxPackets, | 83 _audioJitterBufferMaxPackets, |
83 _iceConnectionReceivingTimeout, | 84 _iceConnectionReceivingTimeout, |
84 _iceBackupCandidatePairPingInterval, | 85 _iceBackupCandidatePairPingInterval, |
85 _iceCandidatePoolSize, | 86 _iceCandidatePoolSize, |
86 _pruneTurnPorts, | 87 _shouldPruneTurnPorts, |
87 _presumeWritableWhenFullyRelayed]; | 88 _shouldPresumeWritableWhenFullyRelayed]; |
88 } | 89 } |
89 | 90 |
90 #pragma mark - Private | 91 #pragma mark - Private |
91 | 92 |
92 - (webrtc::PeerConnectionInterface::RTCConfiguration *) | 93 - (webrtc::PeerConnectionInterface::RTCConfiguration *) |
93 createNativeConfiguration { | 94 createNativeConfiguration { |
94 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> | 95 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> |
95 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); | 96 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); |
96 | 97 |
97 for (RTCIceServer *iceServer in _iceServers) { | 98 for (RTCIceServer *iceServer in _iceServers) { |
(...skipping 23 matching lines...) Expand all Loading... | |
121 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 122 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
122 rtc::RTCCertificateGenerator::GenerateCertificate( | 123 rtc::RTCCertificateGenerator::GenerateCertificate( |
123 rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); | 124 rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); |
124 if (!certificate) { | 125 if (!certificate) { |
125 RTCLogError(@"Failed to generate certificate."); | 126 RTCLogError(@"Failed to generate certificate."); |
126 return nullptr; | 127 return nullptr; |
127 } | 128 } |
128 nativeConfig->certificates.push_back(certificate); | 129 nativeConfig->certificates.push_back(certificate); |
129 } | 130 } |
130 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize; | 131 nativeConfig->ice_candidate_pool_size = _iceCandidatePoolSize; |
131 nativeConfig->prune_turn_ports = _pruneTurnPorts; | 132 nativeConfig->prune_turn_ports = _shouldPruneTurnPorts; |
tkchin_webrtc
2016/07/11 19:52:21
_shouldPruneTurnPorts ? true : false;
honghaiz3
2016/07/11 20:00:00
Done. Thanks!
| |
132 nativeConfig->presume_writable_when_fully_relayed = | 133 nativeConfig->presume_writable_when_fully_relayed = |
133 _presumeWritableWhenFullyRelayed; | 134 _shouldPresumeWritableWhenFullyRelayed; |
tkchin_webrtc
2016/07/11 19:52:21
_shouldPresumeWritableWhenFullyRelayed ? true : fa
honghaiz3
2016/07/11 20:00:00
Done.
| |
134 | 135 |
135 return nativeConfig.release(); | 136 return nativeConfig.release(); |
136 } | 137 } |
137 | 138 |
138 + (webrtc::PeerConnectionInterface::IceTransportsType) | 139 + (webrtc::PeerConnectionInterface::IceTransportsType) |
139 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { | 140 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { |
140 switch (policy) { | 141 switch (policy) { |
141 case RTCIceTransportPolicyNone: | 142 case RTCIceTransportPolicyNone: |
142 return webrtc::PeerConnectionInterface::kNone; | 143 return webrtc::PeerConnectionInterface::kNone; |
143 case RTCIceTransportPolicyRelay: | 144 case RTCIceTransportPolicyRelay: |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 (RTCEncryptionKeyType)keyType { | 335 (RTCEncryptionKeyType)keyType { |
335 switch (keyType) { | 336 switch (keyType) { |
336 case RTCEncryptionKeyTypeRSA: | 337 case RTCEncryptionKeyTypeRSA: |
337 return rtc::KT_RSA; | 338 return rtc::KT_RSA; |
338 case RTCEncryptionKeyTypeECDSA: | 339 case RTCEncryptionKeyTypeECDSA: |
339 return rtc::KT_ECDSA; | 340 return rtc::KT_ECDSA; |
340 } | 341 } |
341 } | 342 } |
342 | 343 |
343 @end | 344 @end |
OLD | NEW |