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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/objc/RTCPeerConnectionInterface.mm
diff --git a/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm b/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm
index 7cc10e9d85bf81bffcda25118e668db62089bd14..1ab9c564296be13b9e6c524cf8691930336d7f86 100644
--- a/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm
+++ b/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm
@@ -33,6 +33,8 @@
#include <memory>
+#include "webrtc/base/rtccertificategenerator.h"
+
@implementation RTCConfiguration
@synthesize iceTransportsType = _iceTransportsType;
@@ -83,30 +85,49 @@
#pragma mark - Private
-- (webrtc::PeerConnectionInterface::RTCConfiguration)nativeConfiguration {
- webrtc::PeerConnectionInterface::RTCConfiguration nativeConfig;
- nativeConfig.type = [RTCEnumConverter nativeEnumForIceTransportsType:_iceTransportsType];
+- (webrtc::PeerConnectionInterface::RTCConfiguration *)
+ createNativeConfiguration {
+ std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration>
+ nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration());
+ nativeConfig->type =
+ [RTCEnumConverter nativeEnumForIceTransportsType:_iceTransportsType];
for (RTCICEServer *iceServer : _iceServers) {
- nativeConfig.servers.push_back(iceServer.iceServer);
+ nativeConfig->servers.push_back(iceServer.iceServer);
}
- nativeConfig.bundle_policy = [RTCEnumConverter nativeEnumForBundlePolicy:_bundlePolicy];
- nativeConfig.rtcp_mux_policy = [RTCEnumConverter nativeEnumForRtcpMuxPolicy:_rtcpMuxPolicy];
- nativeConfig.tcp_candidate_policy =
+ nativeConfig->bundle_policy =
+ [RTCEnumConverter nativeEnumForBundlePolicy:_bundlePolicy];
+ nativeConfig->rtcp_mux_policy =
+ [RTCEnumConverter nativeEnumForRtcpMuxPolicy:_rtcpMuxPolicy];
+ nativeConfig->tcp_candidate_policy =
[RTCEnumConverter nativeEnumForTcpCandidatePolicy:_tcpCandidatePolicy];
- nativeConfig.audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets;
- nativeConfig.ice_connection_receiving_timeout = _iceConnectionReceivingTimeout;
- nativeConfig.ice_backup_candidate_pair_ping_interval = _iceBackupCandidatePairPingInterval;
- if (_keyType == kRTCEncryptionKeyTypeECDSA) {
- std::unique_ptr<rtc::SSLIdentity> identity(
- rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA));
- if (identity) {
- nativeConfig.certificates.push_back(
- rtc::RTCCertificate::Create(std::move(identity)));
- } else {
- RTCLogWarning(@"Failed to generate ECDSA identity. RSA will be used.");
+ nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets;
+ nativeConfig->ice_connection_receiving_timeout =
+ _iceConnectionReceivingTimeout;
+ nativeConfig->ice_backup_candidate_pair_ping_interval =
+ _iceBackupCandidatePairPingInterval;
+ rtc::KeyType keyType =
+ [[self class] nativeEncryptionKeyTypeForKeyType:_keyType];
+ if (keyType != rtc::KT_DEFAULT) {
+ rtc::scoped_refptr<rtc::RTCCertificate> certificate =
+ rtc::RTCCertificateGenerator::GenerateCertificate(
+ rtc::KeyParams(keyType), rtc::Optional<uint64_t>());
+ if (!certificate) {
+ RTCLogError(@"Failed to generate certificate.");
+ return nullptr;
}
+ nativeConfig->certificates.push_back(certificate);
+ }
+ return nativeConfig.release();
+}
+
++ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType:
+ (RTCEncryptionKeyType)keyType {
+ switch (keyType) {
+ case kRTCEncryptionKeyTypeRSA:
+ return rtc::KT_RSA;
+ case kRTCEncryptionKeyTypeECDSA:
+ return rtc::KT_ECDSA;
}
- return nativeConfig;
}
@end
« 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