Index: webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm |
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm b/webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm |
index 0bb85a29b6d937fb8d5f2fc8be77cb401bed079d..5beae99ed990a9ada498b6d069612842034902d3 100644 |
--- a/webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm |
+++ b/webrtc/sdk/objc/Framework/Classes/RTCConfiguration.mm |
@@ -15,6 +15,7 @@ |
#import "RTCIceServer+Private.h" |
#import "WebRTC/RTCLogging.h" |
+#include "webrtc/base/rtccertificategenerator.h" |
#include "webrtc/base/sslidentity.h" |
@implementation RTCConfiguration |
@@ -74,39 +75,43 @@ |
#pragma mark - Private |
-- (webrtc::PeerConnectionInterface::RTCConfiguration)nativeConfiguration { |
- webrtc::PeerConnectionInterface::RTCConfiguration nativeConfig; |
+- (webrtc::PeerConnectionInterface::RTCConfiguration*)nativeConfiguration { |
tkchin_webrtc
2016/05/13 17:48:05
RTCConfiguration *)
hbos
2016/05/16 12:49:05
Done.
|
+ std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> |
tkchin_webrtc
2016/05/13 17:48:05
Are we returning a pointer to avoid memory copy? O
tkchin_webrtc
2016/05/13 18:07:38
and by factory I meant peerconnection's private in
hbos
2016/05/16 12:49:05
To say that we failed to generate the configuratio
|
+ nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); |
for (RTCIceServer *iceServer in _iceServers) { |
- nativeConfig.servers.push_back(iceServer.nativeServer); |
+ nativeConfig->servers.push_back(iceServer.nativeServer); |
} |
- nativeConfig.type = |
+ nativeConfig->type = |
[[self class] nativeTransportsTypeForTransportPolicy:_iceTransportPolicy]; |
- nativeConfig.bundle_policy = |
+ nativeConfig->bundle_policy = |
[[self class] nativeBundlePolicyForPolicy:_bundlePolicy]; |
- nativeConfig.rtcp_mux_policy = |
+ nativeConfig->rtcp_mux_policy = |
[[self class] nativeRtcpMuxPolicyForPolicy:_rtcpMuxPolicy]; |
- nativeConfig.tcp_candidate_policy = |
+ nativeConfig->tcp_candidate_policy = |
[[self class] nativeTcpCandidatePolicyForPolicy:_tcpCandidatePolicy]; |
- nativeConfig.continual_gathering_policy = [[self class] |
+ nativeConfig->continual_gathering_policy = [[self class] |
nativeContinualGatheringPolicyForPolicy:_continualGatheringPolicy]; |
- nativeConfig.audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; |
- nativeConfig.ice_connection_receiving_timeout = |
+ nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; |
+ nativeConfig->ice_connection_receiving_timeout = |
_iceConnectionReceivingTimeout; |
- nativeConfig.ice_backup_candidate_pair_ping_interval = |
+ nativeConfig->ice_backup_candidate_pair_ping_interval = |
_iceBackupCandidatePairPingInterval; |
- if (_keyType == RTCEncryptionKeyTypeECDSA) { |
- 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."); |
+ rtc::KeyType keyType = |
+ [[self class] nativeEncryptionKeyTypeForKeyType:_keyType]; |
+ // Generate non-default certificate. |
+ if (keyType != rtc::KT_DEFAULT) { |
+ rtc::scoped_refptr<rtc::RTCCertificate> certificate = |
+ rtc::RTCCertificateGenerator::GenerateCertificate( |
+ rtc::KeyParams(keyType), rtc::Optional<uint64_t>()); |
+ if (!certificate) { |
+ RTCLogWarning(@"Failed to generate certificate."); |
tkchin_webrtc
2016/05/13 17:48:05
this is an error because you will fail to create t
tkchin_webrtc
2016/05/13 18:07:38
I meant peerconnection via [factory peerconnection
hbos
2016/05/16 12:49:05
RTCLogError - Done.
|
+ return nullptr; |
} |
+ nativeConfig->certificates.push_back(certificate); |
} |
- return nativeConfig; |
+ return nativeConfig.release(); |
} |
+ (webrtc::PeerConnectionInterface::IceTransportsType) |
@@ -224,6 +229,16 @@ |
} |
} |
++ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType: |
+ (RTCEncryptionKeyType)keyType { |
+ switch (keyType) { |
+ case RTCEncryptionKeyTypeRSA: |
+ return rtc::KT_RSA; |
+ case RTCEncryptionKeyTypeECDSA: |
+ return rtc::KT_ECDSA; |
+ } |
+} |
+ |
+ (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativePolicy: |
(webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativePolicy { |
switch (nativePolicy) { |