| 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,
|
| + dtls_identity_store.Pass(), configuration)) {
|
| + return false;
|
| + }
|
| + 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,
|
| + 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;
|
| }
|
|
|
|
|