Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1064)

Side by Side Diff: talk/app/webrtc/objc/RTCPeerConnectionInterface.mm

Issue 2035473004: RTCPeerConnectionInterface.mm createNativeConfiguration and other clean-up. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed presubmit warnings (lines longer than) Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
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 #import "talk/app/webrtc/objc/public/RTCLogging.h"
33 33
34 #include <memory> 34 #include <memory>
35 35
36 #include "webrtc/base/rtccertificategenerator.h"
37
36 @implementation RTCConfiguration 38 @implementation RTCConfiguration
37 39
38 @synthesize iceTransportsType = _iceTransportsType; 40 @synthesize iceTransportsType = _iceTransportsType;
39 @synthesize iceServers = _iceServers; 41 @synthesize iceServers = _iceServers;
40 @synthesize bundlePolicy = _bundlePolicy; 42 @synthesize bundlePolicy = _bundlePolicy;
41 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; 43 @synthesize rtcpMuxPolicy = _rtcpMuxPolicy;
42 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; 44 @synthesize tcpCandidatePolicy = _tcpCandidatePolicy;
43 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; 45 @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets;
44 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; 46 @synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout;
45 @synthesize iceBackupCandidatePairPingInterval = _iceBackupCandidatePairPingInte rval; 47 @synthesize iceBackupCandidatePairPingInterval = _iceBackupCandidatePairPingInte rval;
(...skipping 30 matching lines...) Expand all
76 _tcpCandidatePolicy = tcpCandidatePolicy; 78 _tcpCandidatePolicy = tcpCandidatePolicy;
77 _audioJitterBufferMaxPackets = audioJitterBufferMaxPackets; 79 _audioJitterBufferMaxPackets = audioJitterBufferMaxPackets;
78 _iceConnectionReceivingTimeout = iceConnectionReceivingTimeout; 80 _iceConnectionReceivingTimeout = iceConnectionReceivingTimeout;
79 _iceBackupCandidatePairPingInterval = iceBackupCandidatePairPingInterval; 81 _iceBackupCandidatePairPingInterval = iceBackupCandidatePairPingInterval;
80 } 82 }
81 return self; 83 return self;
82 } 84 }
83 85
84 #pragma mark - Private 86 #pragma mark - Private
85 87
86 - (webrtc::PeerConnectionInterface::RTCConfiguration)nativeConfiguration { 88 - (webrtc::PeerConnectionInterface::RTCConfiguration *)
87 webrtc::PeerConnectionInterface::RTCConfiguration nativeConfig; 89 createNativeConfiguration {
88 nativeConfig.type = [RTCEnumConverter nativeEnumForIceTransportsType:_iceTrans portsType]; 90 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration>
91 nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration());
92 nativeConfig->type =
93 [RTCEnumConverter nativeEnumForIceTransportsType:_iceTransportsType];
89 for (RTCICEServer *iceServer : _iceServers) { 94 for (RTCICEServer *iceServer : _iceServers) {
90 nativeConfig.servers.push_back(iceServer.iceServer); 95 nativeConfig->servers.push_back(iceServer.iceServer);
91 } 96 }
92 nativeConfig.bundle_policy = [RTCEnumConverter nativeEnumForBundlePolicy:_bund lePolicy]; 97 nativeConfig->bundle_policy =
93 nativeConfig.rtcp_mux_policy = [RTCEnumConverter nativeEnumForRtcpMuxPolicy:_r tcpMuxPolicy]; 98 [RTCEnumConverter nativeEnumForBundlePolicy:_bundlePolicy];
94 nativeConfig.tcp_candidate_policy = 99 nativeConfig->rtcp_mux_policy =
100 [RTCEnumConverter nativeEnumForRtcpMuxPolicy:_rtcpMuxPolicy];
101 nativeConfig->tcp_candidate_policy =
95 [RTCEnumConverter nativeEnumForTcpCandidatePolicy:_tcpCandidatePolicy]; 102 [RTCEnumConverter nativeEnumForTcpCandidatePolicy:_tcpCandidatePolicy];
96 nativeConfig.audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; 103 nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets;
97 nativeConfig.ice_connection_receiving_timeout = _iceConnectionReceivingTimeout ; 104 nativeConfig->ice_connection_receiving_timeout =
98 nativeConfig.ice_backup_candidate_pair_ping_interval = _iceBackupCandidatePair PingInterval; 105 _iceConnectionReceivingTimeout;
99 if (_keyType == kRTCEncryptionKeyTypeECDSA) { 106 nativeConfig->ice_backup_candidate_pair_ping_interval =
100 std::unique_ptr<rtc::SSLIdentity> identity( 107 _iceBackupCandidatePairPingInterval;
101 rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA)); 108 rtc::KeyType keyType =
102 if (identity) { 109 [[self class] nativeEncryptionKeyTypeForKeyType:_keyType];
103 nativeConfig.certificates.push_back( 110 if (keyType != rtc::KT_DEFAULT) {
104 rtc::RTCCertificate::Create(std::move(identity))); 111 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
105 } else { 112 rtc::RTCCertificateGenerator::GenerateCertificate(
106 RTCLogWarning(@"Failed to generate ECDSA identity. RSA will be used."); 113 rtc::KeyParams(keyType), rtc::Optional<uint64_t>());
114 if (!certificate) {
115 RTCLogError(@"Failed to generate certificate.");
116 return nullptr;
107 } 117 }
118 nativeConfig->certificates.push_back(certificate);
108 } 119 }
109 return nativeConfig; 120 return nativeConfig.release();
121 }
122
123 + (rtc::KeyType)nativeEncryptionKeyTypeForKeyType:
124 (RTCEncryptionKeyType)keyType {
125 switch (keyType) {
126 case kRTCEncryptionKeyTypeRSA:
127 return rtc::KT_RSA;
128 case kRTCEncryptionKeyTypeECDSA:
129 return rtc::KT_ECDSA;
130 }
110 } 131 }
111 132
112 @end 133 @end
OLDNEW
« no previous file with comments | « talk/app/webrtc/objc/RTCPeerConnectionFactory.mm ('k') | talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698