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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], | 68 [[self class] stringForTcpCandidatePolicy:_tcpCandidatePolicy], |
69 [[self class] | 69 [[self class] |
70 stringForContinualGatheringPolicy:_continualGatheringPolicy], | 70 stringForContinualGatheringPolicy:_continualGatheringPolicy], |
71 _audioJitterBufferMaxPackets, | 71 _audioJitterBufferMaxPackets, |
72 _iceConnectionReceivingTimeout, | 72 _iceConnectionReceivingTimeout, |
73 _iceBackupCandidatePairPingInterval]; | 73 _iceBackupCandidatePairPingInterval]; |
74 } | 74 } |
75 | 75 |
76 #pragma mark - Private | 76 #pragma mark - Private |
77 | 77 |
78 - (webrtc::PeerConnectionInterface::RTCConfiguration*)nativeConfiguration { | 78 - (webrtc::PeerConnectionInterface::RTCConfiguration *) |
| 79 createNativeConfiguration { |
79 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> | 80 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> |
80 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); | 81 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); |
81 | 82 |
82 for (RTCIceServer *iceServer in _iceServers) { | 83 for (RTCIceServer *iceServer in _iceServers) { |
83 nativeConfig->servers.push_back(iceServer.nativeServer); | 84 nativeConfig->servers.push_back(iceServer.nativeServer); |
84 } | 85 } |
85 nativeConfig->type = | 86 nativeConfig->type = |
86 [[self class] nativeTransportsTypeForTransportPolicy:_iceTransportPolicy]; | 87 [[self class] nativeTransportsTypeForTransportPolicy:_iceTransportPolicy]; |
87 nativeConfig->bundle_policy = | 88 nativeConfig->bundle_policy = |
88 [[self class] nativeBundlePolicyForPolicy:_bundlePolicy]; | 89 [[self class] nativeBundlePolicyForPolicy:_bundlePolicy]; |
89 nativeConfig->rtcp_mux_policy = | 90 nativeConfig->rtcp_mux_policy = |
90 [[self class] nativeRtcpMuxPolicyForPolicy:_rtcpMuxPolicy]; | 91 [[self class] nativeRtcpMuxPolicyForPolicy:_rtcpMuxPolicy]; |
91 nativeConfig->tcp_candidate_policy = | 92 nativeConfig->tcp_candidate_policy = |
92 [[self class] nativeTcpCandidatePolicyForPolicy:_tcpCandidatePolicy]; | 93 [[self class] nativeTcpCandidatePolicyForPolicy:_tcpCandidatePolicy]; |
93 nativeConfig->continual_gathering_policy = [[self class] | 94 nativeConfig->continual_gathering_policy = [[self class] |
94 nativeContinualGatheringPolicyForPolicy:_continualGatheringPolicy]; | 95 nativeContinualGatheringPolicyForPolicy:_continualGatheringPolicy]; |
95 nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; | 96 nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; |
96 nativeConfig->ice_connection_receiving_timeout = | 97 nativeConfig->ice_connection_receiving_timeout = |
97 _iceConnectionReceivingTimeout; | 98 _iceConnectionReceivingTimeout; |
98 nativeConfig->ice_backup_candidate_pair_ping_interval = | 99 nativeConfig->ice_backup_candidate_pair_ping_interval = |
99 _iceBackupCandidatePairPingInterval; | 100 _iceBackupCandidatePairPingInterval; |
100 rtc::KeyType keyType = | 101 rtc::KeyType keyType = |
101 [[self class] nativeEncryptionKeyTypeForKeyType:_keyType]; | 102 [[self class] nativeEncryptionKeyTypeForKeyType:_keyType]; |
102 // Generate non-default certificate. | 103 // Generate non-default certificate. |
103 if (keyType != rtc::KT_DEFAULT) { | 104 if (keyType != rtc::KT_DEFAULT) { |
104 rtc::scoped_refptr<rtc::RTCCertificate> certificate = | 105 rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
105 rtc::RTCCertificateGenerator::GenerateCertificate( | 106 rtc::RTCCertificateGenerator::GenerateCertificate( |
106 rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); | 107 rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); |
107 if (!certificate) { | 108 if (!certificate) { |
108 RTCLogWarning(@"Failed to generate certificate."); | 109 RTCLogError(@"Failed to generate certificate."); |
109 return nullptr; | 110 return nullptr; |
110 } | 111 } |
111 nativeConfig->certificates.push_back(certificate); | 112 nativeConfig->certificates.push_back(certificate); |
112 } | 113 } |
113 | 114 |
114 return nativeConfig.release(); | 115 return nativeConfig.release(); |
115 } | 116 } |
116 | 117 |
117 + (webrtc::PeerConnectionInterface::IceTransportsType) | 118 + (webrtc::PeerConnectionInterface::IceTransportsType) |
118 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { | 119 nativeTransportsTypeForTransportPolicy:(RTCIceTransportPolicy)policy { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 (RTCContinualGatheringPolicy)policy { | 284 (RTCContinualGatheringPolicy)policy { |
284 switch (policy) { | 285 switch (policy) { |
285 case RTCContinualGatheringPolicyGatherOnce: | 286 case RTCContinualGatheringPolicyGatherOnce: |
286 return @"GATHER_ONCE"; | 287 return @"GATHER_ONCE"; |
287 case RTCContinualGatheringPolicyGatherContinually: | 288 case RTCContinualGatheringPolicyGatherContinually: |
288 return @"GATHER_CONTINUALLY"; | 289 return @"GATHER_CONTINUALLY"; |
289 } | 290 } |
290 } | 291 } |
291 | 292 |
292 @end | 293 @end |
OLD | NEW |