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

Unified Diff: talk/app/webrtc/peerconnection.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/peerconnection.cc
diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc
index a53e2cb510ef9806299f6314617ff8ccc0d41d82..83b954fe4f2ff7a569dea95446b7dd62adb2d2db 100644
--- a/talk/app/webrtc/peerconnection.cc
+++ b/talk/app/webrtc/peerconnection.cc
@@ -351,6 +351,46 @@ bool PeerConnection::Initialize(
PortAllocatorFactoryInterface* allocator_factory,
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) {
+ if (!InitializeInternal(configuration, constraints, allocator_factory,
+ observer)) {
+ return false;
+ }
+
+ // Initialize the WebRtcSession with our optional |dtls_identity_store|.
+ // It creates transport channels etc.
+ if (!session_->Initialize(factory_->options(), constraints,
tommi (sloooow) - chröme 2015/08/18 14:49:35 return session_->Initialize(...);
+ dtls_identity_store.Pass(), configuration)) {
+ return false;
tommi (sloooow) - chröme 2015/08/18 14:49:35 if we hit this, do we have to undo some of the wor
+ }
+ return true;
+}
+
+bool PeerConnection::Initialize(
+ const PeerConnectionInterface::RTCConfiguration& configuration,
+ const MediaConstraintsInterface* constraints,
+ PortAllocatorFactoryInterface* allocator_factory,
+ const rtc::scoped_refptr<DtlsCertificate>& certificate,
+ PeerConnectionObserver* observer) {
+ DCHECK(certificate.get());
+ if (!InitializeInternal(configuration, constraints, allocator_factory,
+ observer)) {
+ return false;
+ }
+
+ // Initialize the WebRtcSession with our |certificate|.
+ // It creates transport channels etc.
+ if (!session_->Initialize(factory_->options(), constraints,
tommi (sloooow) - chröme 2015/08/18 14:49:35 nit: return session_->Initialize(...);
+ certificate, configuration)) {
+ return false;
+ }
+ return true;
+}
+
+bool PeerConnection::InitializeInternal(
+ const PeerConnectionInterface::RTCConfiguration& configuration,
+ const MediaConstraintsInterface* constraints,
+ PortAllocatorFactoryInterface* allocator_factory,
+ PeerConnectionObserver* observer) {
ASSERT(observer != NULL);
if (!observer)
return false;
@@ -399,19 +439,14 @@ bool PeerConnection::Initialize(
factory_->worker_thread(),
port_allocator_.get(),
mediastream_signaling_.get()));
- stream_handler_container_.reset(new MediaStreamHandlerContainer(
- session_.get(), session_.get()));
- stats_.reset(new StatsCollector(session_.get()));
-
- // Initialize the WebRtcSession. It creates transport channels etc.
- if (!session_->Initialize(factory_->options(), constraints,
- dtls_identity_store.Pass(), configuration))
- return false;
-
// Register PeerConnection as receiver of local ice candidates.
// All the callbacks will be posted to the application from PeerConnection.
session_->RegisterIceObserver(this);
session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange);
+
+ stream_handler_container_.reset(new MediaStreamHandlerContainer(
+ session_.get(), session_.get()));
+ stats_.reset(new StatsCollector(session_.get()));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698