Chromium Code Reviews| Index: talk/app/webrtc/peerconnection.cc |
| diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc |
| index a53e2cb510ef9806299f6314617ff8ccc0d41d82..a2ccd21b9432946daa3535366b95977b209fa278 100644 |
| --- a/talk/app/webrtc/peerconnection.cc |
| +++ b/talk/app/webrtc/peerconnection.cc |
| @@ -351,6 +351,48 @@ bool PeerConnection::Initialize( |
| PortAllocatorFactoryInterface* allocator_factory, |
| rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| PeerConnectionObserver* observer) { |
| + if (!InitializeCommon(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; |
| + } |
| + InitializeSessionAfterInit(); |
| + 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 (!InitializeCommon(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; |
| + } |
| + InitializeSessionAfterInit(); |
| + return true; |
| +} |
| + |
| +bool PeerConnection::InitializeCommon( |
|
Henrik Grunell WebRTC
2015/08/12 14:46:29
InitializeInternal() is slightly better imo.
hbos
2015/08/14 14:09:38
Done.
|
| + const PeerConnectionInterface::RTCConfiguration& configuration, |
| + const MediaConstraintsInterface* constraints, |
| + PortAllocatorFactoryInterface* allocator_factory, |
| + PeerConnectionObserver* observer) { |
| ASSERT(observer != NULL); |
| if (!observer) |
| return false; |
| @@ -402,17 +444,14 @@ bool PeerConnection::Initialize( |
| stream_handler_container_.reset(new MediaStreamHandlerContainer( |
| session_.get(), session_.get())); |
| stats_.reset(new StatsCollector(session_.get())); |
| + return true; |
| +} |
| - // Initialize the WebRtcSession. It creates transport channels etc. |
| - if (!session_->Initialize(factory_->options(), constraints, |
| - dtls_identity_store.Pass(), configuration)) |
| - return false; |
| - |
| +void PeerConnection::InitializeSessionAfterInit() { |
|
Henrik Grunell WebRTC
2015/08/12 14:46:29
Maybe RegisterAsIceObserver()?
hbos
2015/08/14 14:09:38
Function not needed anymore.
|
| // 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); |
| - return true; |
| } |
| rtc::scoped_refptr<StreamCollectionInterface> |