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

Unified Diff: talk/app/webrtc/peerconnectionfactory.cc

Issue 1269843005: Added DtlsCertificate, a ref counted object owning an SSLIdentity (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merge with master Created 5 years, 4 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/peerconnectionfactory.cc
diff --git a/talk/app/webrtc/peerconnectionfactory.cc b/talk/app/webrtc/peerconnectionfactory.cc
index 26765d21097ff81a791b4ac54b64fa207eb0d48c..aeb41ff955460b8d88eeb75f7970bdb4d9919026 100644
--- a/talk/app/webrtc/peerconnectionfactory.cc
+++ b/talk/app/webrtc/peerconnectionfactory.cc
@@ -231,17 +231,42 @@ PeerConnectionFactory::CreatePeerConnection(
DCHECK(signaling_thread_->IsCurrent());
DCHECK(allocator_factory || default_allocator_factory_);
+ PortAllocatorFactoryInterface* chosen_allocator_factory =
+ CreatePeerConnectionChooseAllocatorFactory(allocator_factory);
+
if (!dtls_identity_store.get()) {
- // Because |pc|->Initialize takes ownership of the store we need a new
- // wrapper object that can be deleted without deleting the underlying
- // |dtls_identity_store_|, protecting it from being deleted multiple times.
+ // Because |pc|->Initialize takes ownership of the store in Pass()ing we
+ // need a new wrapper object that can be passed and eventually deleted
+ // without passing and deleting our |dtls_identity_store_|.
dtls_identity_store.reset(
new DtlsIdentityStoreWrapper(dtls_identity_store_));
}
+ rtc::scoped_refptr<PeerConnection> pc(
+ new rtc::RefCountedObject<PeerConnection>(this));
+ if (!pc->Initialize(
+ configuration,
+ constraints,
+ chosen_allocator_factory,
+ dtls_identity_store.Pass(),
+ observer)) {
+ return nullptr;
+ }
+ return PeerConnectionProxy::Create(signaling_thread(), pc);
+}
+
+rtc::scoped_refptr<PeerConnectionInterface>
+PeerConnectionFactory::CreatePeerConnection(
+ const PeerConnectionInterface::RTCConfiguration& configuration,
+ const MediaConstraintsInterface* constraints,
+ PortAllocatorFactoryInterface* allocator_factory,
+ const rtc::scoped_refptr<DtlsCertificate>& certificate,
+ PeerConnectionObserver* observer) {
+ DCHECK(signaling_thread_->IsCurrent());
+ DCHECK(allocator_factory || default_allocator_factory_);
+
PortAllocatorFactoryInterface* chosen_allocator_factory =
- allocator_factory ? allocator_factory : default_allocator_factory_.get();
- chosen_allocator_factory->SetNetworkIgnoreMask(options_.network_ignore_mask);
+ CreatePeerConnectionChooseAllocatorFactory(allocator_factory);
rtc::scoped_refptr<PeerConnection> pc(
new rtc::RefCountedObject<PeerConnection>(this));
@@ -249,13 +274,26 @@ PeerConnectionFactory::CreatePeerConnection(
configuration,
constraints,
chosen_allocator_factory,
- dtls_identity_store.Pass(),
+ certificate,
observer)) {
- return NULL;
+ return nullptr;
}
return PeerConnectionProxy::Create(signaling_thread(), pc);
}
+PortAllocatorFactoryInterface*
+PeerConnectionFactory::CreatePeerConnectionChooseAllocatorFactory(
+ PortAllocatorFactoryInterface* allocator_factory) {
+ DCHECK(signaling_thread_->IsCurrent());
+ DCHECK(allocator_factory || default_allocator_factory_);
+
+ PortAllocatorFactoryInterface* chosen_allocator_factory =
+ allocator_factory ? allocator_factory : default_allocator_factory_.get();
+ chosen_allocator_factory->SetNetworkIgnoreMask(options_.network_ignore_mask);
+
+ return chosen_allocator_factory;
+}
+
rtc::scoped_refptr<MediaStreamInterface>
PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) {
DCHECK(signaling_thread_->IsCurrent());

Powered by Google App Engine
This is Rietveld 408576698