OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #import "talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h" | 28 #import "talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h" |
29 | 29 |
30 #import "talk/app/webrtc/objc/RTCEnumConverter.h" | 30 #import "talk/app/webrtc/objc/RTCEnumConverter.h" |
31 #import "talk/app/webrtc/objc/RTCICEServer+Internal.h" | 31 #import "talk/app/webrtc/objc/RTCICEServer+Internal.h" |
| 32 #import "talk/app/webrtc/objc/public/RTCLogging.h" |
32 | 33 |
33 @implementation RTCConfiguration | 34 @implementation RTCConfiguration |
34 | 35 |
35 @synthesize iceTransportsType = _iceTransportsType; | 36 @synthesize iceTransportsType = _iceTransportsType; |
36 @synthesize iceServers = _iceServers; | 37 @synthesize iceServers = _iceServers; |
37 @synthesize bundlePolicy = _bundlePolicy; | 38 @synthesize bundlePolicy = _bundlePolicy; |
38 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; | 39 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; |
39 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; | 40 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; |
40 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; | 41 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; |
41 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; | 42 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; |
42 @synthesize iceBackupCandidatePairPingInterval = _iceBackupCandidatePairPingInte
rval; | 43 @synthesize iceBackupCandidatePairPingInterval = _iceBackupCandidatePairPingInte
rval; |
| 44 @synthesize keyType = _keyType; |
43 | 45 |
44 - (instancetype)init { | 46 - (instancetype)init { |
45 if (self = [super init]) { | 47 if (self = [super init]) { |
46 // Copy defaults. | 48 // Copy defaults. |
47 webrtc::PeerConnectionInterface::RTCConfiguration config; | 49 webrtc::PeerConnectionInterface::RTCConfiguration config; |
48 _iceTransportsType = [RTCEnumConverter iceTransportsTypeForNativeEnum:config
.type]; | 50 _iceTransportsType = [RTCEnumConverter iceTransportsTypeForNativeEnum:config
.type]; |
49 _bundlePolicy = [RTCEnumConverter bundlePolicyForNativeEnum:config.bundle_po
licy]; | 51 _bundlePolicy = [RTCEnumConverter bundlePolicyForNativeEnum:config.bundle_po
licy]; |
50 _rtcpMuxPolicy = [RTCEnumConverter rtcpMuxPolicyForNativeEnum:config.rtcp_mu
x_policy]; | 52 _rtcpMuxPolicy = [RTCEnumConverter rtcpMuxPolicyForNativeEnum:config.rtcp_mu
x_policy]; |
51 _tcpCandidatePolicy = | 53 _tcpCandidatePolicy = |
52 [RTCEnumConverter tcpCandidatePolicyForNativeEnum:config.tcp_candidate_p
olicy]; | 54 [RTCEnumConverter tcpCandidatePolicyForNativeEnum:config.tcp_candidate_p
olicy]; |
53 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; | 55 _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; |
54 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; | 56 _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; |
55 _iceBackupCandidatePairPingInterval = config.ice_backup_candidate_pair_ping_
interval; | 57 _iceBackupCandidatePairPingInterval = config.ice_backup_candidate_pair_ping_
interval; |
| 58 _keyType = kRTCEncryptionKeyTypeECDSA; |
56 } | 59 } |
57 return self; | 60 return self; |
58 } | 61 } |
59 | 62 |
60 - (instancetype)initWithIceTransportsType:(RTCIceTransportsType)iceTransportsTyp
e | 63 - (instancetype)initWithIceTransportsType:(RTCIceTransportsType)iceTransportsTyp
e |
61 bundlePolicy:(RTCBundlePolicy)bundlePolicy | 64 bundlePolicy:(RTCBundlePolicy)bundlePolicy |
62 rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy | 65 rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy |
63 tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePol
icy | 66 tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePol
icy |
64 audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets | 67 audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets |
65 iceConnectionReceivingTimeout:(int)iceConnectionReceivingTimeout | 68 iceConnectionReceivingTimeout:(int)iceConnectionReceivingTimeout |
(...skipping 18 matching lines...) Expand all Loading... |
84 for (RTCICEServer *iceServer : _iceServers) { | 87 for (RTCICEServer *iceServer : _iceServers) { |
85 nativeConfig.servers.push_back(iceServer.iceServer); | 88 nativeConfig.servers.push_back(iceServer.iceServer); |
86 } | 89 } |
87 nativeConfig.bundle_policy = [RTCEnumConverter nativeEnumForBundlePolicy:_bund
lePolicy]; | 90 nativeConfig.bundle_policy = [RTCEnumConverter nativeEnumForBundlePolicy:_bund
lePolicy]; |
88 nativeConfig.rtcp_mux_policy = [RTCEnumConverter nativeEnumForRtcpMuxPolicy:_r
tcpMuxPolicy]; | 91 nativeConfig.rtcp_mux_policy = [RTCEnumConverter nativeEnumForRtcpMuxPolicy:_r
tcpMuxPolicy]; |
89 nativeConfig.tcp_candidate_policy = | 92 nativeConfig.tcp_candidate_policy = |
90 [RTCEnumConverter nativeEnumForTcpCandidatePolicy:_tcpCandidatePolicy]; | 93 [RTCEnumConverter nativeEnumForTcpCandidatePolicy:_tcpCandidatePolicy]; |
91 nativeConfig.audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; | 94 nativeConfig.audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; |
92 nativeConfig.ice_connection_receiving_timeout = _iceConnectionReceivingTimeout
; | 95 nativeConfig.ice_connection_receiving_timeout = _iceConnectionReceivingTimeout
; |
93 nativeConfig.ice_backup_candidate_pair_ping_interval = _iceBackupCandidatePair
PingInterval; | 96 nativeConfig.ice_backup_candidate_pair_ping_interval = _iceBackupCandidatePair
PingInterval; |
| 97 if (_keyType == kRTCEncryptionKeyTypeECDSA) { |
| 98 rtc::scoped_ptr<rtc::SSLIdentity> identity( |
| 99 rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA)); |
| 100 if (identity) { |
| 101 nativeConfig.certificates.push_back( |
| 102 rtc::RTCCertificate::Create(std::move(identity))); |
| 103 } else { |
| 104 RTCLogWarning(@"Failed to generate ECDSA identity. RSA will be used."); |
| 105 } |
| 106 } |
94 return nativeConfig; | 107 return nativeConfig; |
95 } | 108 } |
96 | 109 |
97 @end | 110 @end |
OLD | NEW |