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