| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 @implementation RTCConfiguration | 22 @implementation RTCConfiguration |
| 23 | 23 |
| 24 @synthesize iceServers = _iceServers; | 24 @synthesize iceServers = _iceServers; |
| 25 @synthesize iceTransportPolicy = _iceTransportPolicy; | 25 @synthesize iceTransportPolicy = _iceTransportPolicy; |
| 26 @synthesize bundlePolicy = _bundlePolicy; | 26 @synthesize bundlePolicy = _bundlePolicy; |
| 27 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; | 27 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; |
| 28 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; | 28 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; |
| 29 @synthesize candidateNetworkPolicy = _candidateNetworkPolicy; | 29 @synthesize candidateNetworkPolicy = _candidateNetworkPolicy; |
| 30 @synthesize continualGatheringPolicy = _continualGatheringPolicy; | 30 @synthesize continualGatheringPolicy = _continualGatheringPolicy; |
| 31 @synthesize maxIPv6Networks = _maxIPv6Networks; |
| 31 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; | 32 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; |
| 32 @synthesize audioJitterBufferFastAccelerate = _audioJitterBufferFastAccelerate; | 33 @synthesize audioJitterBufferFastAccelerate = _audioJitterBufferFastAccelerate; |
| 33 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; | 34 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; |
| 34 @synthesize iceBackupCandidatePairPingInterval = | 35 @synthesize iceBackupCandidatePairPingInterval = |
| 35 _iceBackupCandidatePairPingInterval; | 36 _iceBackupCandidatePairPingInterval; |
| 36 @synthesize keyType = _keyType; | 37 @synthesize keyType = _keyType; |
| 37 @synthesize iceCandidatePoolSize = _iceCandidatePoolSize; | 38 @synthesize iceCandidatePoolSize = _iceCandidatePoolSize; |
| 38 @synthesize shouldPruneTurnPorts = _shouldPruneTurnPorts; | 39 @synthesize shouldPruneTurnPorts = _shouldPruneTurnPorts; |
| 39 @synthesize shouldPresumeWritableWhenFullyRelayed = | 40 @synthesize shouldPresumeWritableWhenFullyRelayed = |
| 40 _shouldPresumeWritableWhenFullyRelayed; | 41 _shouldPresumeWritableWhenFullyRelayed; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 64 _rtcpMuxPolicy = | 65 _rtcpMuxPolicy = |
| 65 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; | 66 [[self class] rtcpMuxPolicyForNativePolicy:config.rtcp_mux_policy]; |
| 66 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: | 67 _tcpCandidatePolicy = [[self class] tcpCandidatePolicyForNativePolicy: |
| 67 config.tcp_candidate_policy]; | 68 config.tcp_candidate_policy]; |
| 68 _candidateNetworkPolicy = [[self class] | 69 _candidateNetworkPolicy = [[self class] |
| 69 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy]; | 70 candidateNetworkPolicyForNativePolicy:config.candidate_network_policy]; |
| 70 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = | 71 webrtc::PeerConnectionInterface::ContinualGatheringPolicy nativePolicy = |
| 71 config.continual_gathering_policy; | 72 config.continual_gathering_policy; |
| 72 _continualGatheringPolicy = | 73 _continualGatheringPolicy = |
| 73 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; | 74 [[self class] continualGatheringPolicyForNativePolicy:nativePolicy]; |
| 75 _maxIPv6Networks = config.max_ipv6_networks; |
| 74 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; | 76 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; |
| 75 _audioJitterBufferFastAccelerate = config.audio_jitter_buffer_fast_accelerat
e; | 77 _audioJitterBufferFastAccelerate = config.audio_jitter_buffer_fast_accelerat
e; |
| 76 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; | 78 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; |
| 77 _iceBackupCandidatePairPingInterval = | 79 _iceBackupCandidatePairPingInterval = |
| 78 config.ice_backup_candidate_pair_ping_interval; | 80 config.ice_backup_candidate_pair_ping_interval; |
| 79 _keyType = RTCEncryptionKeyTypeECDSA; | 81 _keyType = RTCEncryptionKeyTypeECDSA; |
| 80 _iceCandidatePoolSize = config.ice_candidate_pool_size; | 82 _iceCandidatePoolSize = config.ice_candidate_pool_size; |
| 81 _shouldPruneTurnPorts = config.prune_turn_ports; | 83 _shouldPruneTurnPorts = config.prune_turn_ports; |
| 82 _shouldPresumeWritableWhenFullyRelayed = | 84 _shouldPresumeWritableWhenFullyRelayed = |
| 83 config.presume_writable_when_fully_relayed; | 85 config.presume_writable_when_fully_relayed; |
| 84 if (config.ice_check_min_interval) { | 86 if (config.ice_check_min_interval) { |
| 85 _iceCheckMinInterval = | 87 _iceCheckMinInterval = |
| 86 [NSNumber numberWithInt:*config.ice_check_min_interval]; | 88 [NSNumber numberWithInt:*config.ice_check_min_interval]; |
| 87 } | 89 } |
| 88 if (config.ice_regather_interval_range) { | 90 if (config.ice_regather_interval_range) { |
| 89 const rtc::IntervalRange &nativeIntervalRange = config.ice_regather_interv
al_range.value(); | 91 const rtc::IntervalRange &nativeIntervalRange = config.ice_regather_interv
al_range.value(); |
| 90 _iceRegatherIntervalRange = | 92 _iceRegatherIntervalRange = |
| 91 [[RTCIntervalRange alloc] initWithNativeIntervalRange:nativeIntervalRa
nge]; | 93 [[RTCIntervalRange alloc] initWithNativeIntervalRange:nativeIntervalRa
nge]; |
| 92 } | 94 } |
| 93 } | 95 } |
| 94 return self; | 96 return self; |
| 95 } | 97 } |
| 96 | 98 |
| 97 - (NSString *)description { | 99 - (NSString *)description { |
| 98 return [NSString stringWithFormat: | 100 return |
| 99 @"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}\n", | 101 [NSString stringWithFormat: |
| 100 _iceServers, | 102 @"RTCConfiguration: " |
| 101 [[self class] stringForTransportPolicy:_iceTransportPolicy], | 103 @"{\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\n%d\
n%@\n%@\n%d\n}\n", |
| 102 [[self class] stringForBundlePolicy:_bundlePolicy], | 104 _iceServers, |
| 103 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], | 105 [[self class] stringForTransportPolicy:_iceTransportPolicy], |
| 104 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], | 106 [[self class] stringForBundlePolicy:_bundlePolicy], |
| 105 [[self class] stringForCandidateNetworkPolicy:_candidateNetworkPolicy], | 107 [[self class] stringForRtcpMuxPolicy:_rtcpMuxPolicy], |
| 106 [[self class] | 108 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolic
y], |
| 107 stringForContinualGatheringPolicy:_continualGatheringPolicy], | 109 [[self class] stringForCandidateNetworkPolicy:_candidateNetw
orkPolicy], |
| 108 _audioJitterBufferMaxPackets, | 110 [[self class] stringForContinualGatheringPolicy:_continualGa
theringPolicy], |
| 109 _audioJitterBufferFastAccelerate, | 111 _audioJitterBufferMaxPackets, |
| 110 _iceConnectionReceivingTimeout, | 112 _audioJitterBufferFastAccelerate, |
| 111 _iceBackupCandidatePairPingInterval, | 113 _iceConnectionReceivingTimeout, |
| 112 _iceCandidatePoolSize, | 114 _iceBackupCandidatePairPingInterval, |
| 113 _shouldPruneTurnPorts, | 115 _iceCandidatePoolSize, |
| 114 _shouldPresumeWritableWhenFullyRelayed, | 116 _shouldPruneTurnPorts, |
| 115 _iceCheckMinInterval, | 117 _shouldPresumeWritableWhenFullyRelayed, |
| 116 _iceRegatherIntervalRange]; | 118 _iceCheckMinInterval, |
| 119 _iceRegatherIntervalRange, |
| 120 _maxIPv6Networks]; |
| 117 } | 121 } |
| 118 | 122 |
| 119 #pragma mark - Private | 123 #pragma mark - Private |
| 120 | 124 |
| 121 - (webrtc::PeerConnectionInterface::RTCConfiguration *) | 125 - (webrtc::PeerConnectionInterface::RTCConfiguration *) |
| 122 createNativeConfiguration { | 126 createNativeConfiguration { |
| 123 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> | 127 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> |
| 124 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration( | 128 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration( |
| 125 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive)); | 129 webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive)); |
| 126 | 130 |
| 127 for (RTCIceServer *iceServer in _iceServers) { | 131 for (RTCIceServer *iceServer in _iceServers) { |
| 128 nativeConfig->servers.push_back(iceServer.nativeServer); | 132 nativeConfig->servers.push_back(iceServer.nativeServer); |
| 129 } | 133 } |
| 130 nativeConfig->type = | 134 nativeConfig->type = |
| 131 [[self class] nativeTransportsTypeForTransportPolicy:_iceTransportPolicy]; | 135 [[self class] nativeTransportsTypeForTransportPolicy:_iceTransportPolicy]; |
| 132 nativeConfig->bundle_policy = | 136 nativeConfig->bundle_policy = |
| 133 [[self class] nativeBundlePolicyForPolicy:_bundlePolicy]; | 137 [[self class] nativeBundlePolicyForPolicy:_bundlePolicy]; |
| 134 nativeConfig->rtcp_mux_policy = | 138 nativeConfig->rtcp_mux_policy = |
| 135 [[self class] nativeRtcpMuxPolicyForPolicy:_rtcpMuxPolicy]; | 139 [[self class] nativeRtcpMuxPolicyForPolicy:_rtcpMuxPolicy]; |
| 136 nativeConfig->tcp_candidate_policy = | 140 nativeConfig->tcp_candidate_policy = |
| 137 [[self class] nativeTcpCandidatePolicyForPolicy:_tcpCandidatePolicy]; | 141 [[self class] nativeTcpCandidatePolicyForPolicy:_tcpCandidatePolicy]; |
| 138 nativeConfig->candidate_network_policy = [[self class] | 142 nativeConfig->candidate_network_policy = [[self class] |
| 139 nativeCandidateNetworkPolicyForPolicy:_candidateNetworkPolicy]; | 143 nativeCandidateNetworkPolicyForPolicy:_candidateNetworkPolicy]; |
| 140 nativeConfig->continual_gathering_policy = [[self class] | 144 nativeConfig->continual_gathering_policy = [[self class] |
| 141 nativeContinualGatheringPolicyForPolicy:_continualGatheringPolicy]; | 145 nativeContinualGatheringPolicyForPolicy:_continualGatheringPolicy]; |
| 146 nativeConfig->max_ipv6_networks = _maxIPv6Networks; |
| 142 nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; | 147 nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; |
| 143 nativeConfig->audio_jitter_buffer_fast_accelerate = | 148 nativeConfig->audio_jitter_buffer_fast_accelerate = |
| 144 _audioJitterBufferFastAccelerate ? true : false; | 149 _audioJitterBufferFastAccelerate ? true : false; |
| 145 nativeConfig->ice_connection_receiving_timeout = | 150 nativeConfig->ice_connection_receiving_timeout = |
| 146 _iceConnectionReceivingTimeout; | 151 _iceConnectionReceivingTimeout; |
| 147 nativeConfig->ice_backup_candidate_pair_ping_interval = | 152 nativeConfig->ice_backup_candidate_pair_ping_interval = |
| 148 _iceBackupCandidatePairPingInterval; | 153 _iceBackupCandidatePairPingInterval; |
| 149 rtc::KeyType keyType = | 154 rtc::KeyType keyType = |
| 150 [[self class] nativeEncryptionKeyTypeForKeyType:_keyType]; | 155 [[self class] nativeEncryptionKeyTypeForKeyType:_keyType]; |
| 151 // Generate non-default certificate. | 156 // Generate non-default certificate. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 (RTCEncryptionKeyType)keyType { | 381 (RTCEncryptionKeyType)keyType { |
| 377 switch (keyType) { | 382 switch (keyType) { |
| 378 case RTCEncryptionKeyTypeRSA: | 383 case RTCEncryptionKeyTypeRSA: |
| 379 return rtc::KT_RSA; | 384 return rtc::KT_RSA; |
| 380 case RTCEncryptionKeyTypeECDSA: | 385 case RTCEncryptionKeyTypeECDSA: |
| 381 return rtc::KT_ECDSA; | 386 return rtc::KT_ECDSA; |
| 382 } | 387 } |
| 383 } | 388 } |
| 384 | 389 |
| 385 @end | 390 @end |
| OLD | NEW |