| Index: webrtc/api/peerconnectionfactory.cc
|
| diff --git a/webrtc/api/peerconnectionfactory.cc b/webrtc/api/peerconnectionfactory.cc
|
| index d236b195b183677634eaa08ef6e6a5099c35f486..9cb5b46785cd2a6f50cfb312b2282ebc51e9a9c9 100644
|
| --- a/webrtc/api/peerconnectionfactory.cc
|
| +++ b/webrtc/api/peerconnectionfactory.cc
|
| @@ -74,19 +74,17 @@ CreatePeerConnectionFactory() {
|
| pc_factory);
|
| }
|
|
|
| -rtc::scoped_refptr<PeerConnectionFactoryInterface>
|
| -CreatePeerConnectionFactory(
|
| +rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
|
| + rtc::Thread* network_thread,
|
| rtc::Thread* worker_thread,
|
| rtc::Thread* signaling_thread,
|
| AudioDeviceModule* default_adm,
|
| cricket::WebRtcVideoEncoderFactory* encoder_factory,
|
| cricket::WebRtcVideoDecoderFactory* decoder_factory) {
|
| rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
|
| - new rtc::RefCountedObject<PeerConnectionFactory>(worker_thread,
|
| - signaling_thread,
|
| - default_adm,
|
| - encoder_factory,
|
| - decoder_factory));
|
| + new rtc::RefCountedObject<PeerConnectionFactory>(
|
| + network_thread, worker_thread, signaling_thread, default_adm,
|
| + encoder_factory, decoder_factory));
|
|
|
| // Call Initialize synchronously but make sure its executed on
|
| // |signaling_thread|.
|
| @@ -104,16 +102,19 @@ CreatePeerConnectionFactory(
|
| PeerConnectionFactory::PeerConnectionFactory()
|
| : owns_ptrs_(true),
|
| wraps_current_thread_(false),
|
| - signaling_thread_(rtc::ThreadManager::Instance()->CurrentThread()),
|
| - worker_thread_(new rtc::Thread) {
|
| + network_thread_(rtc::Thread::CreateWithSocketServer().release()),
|
| + worker_thread_(rtc::Thread::Create().release()),
|
| + signaling_thread_(rtc::Thread::Current()) {
|
| if (!signaling_thread_) {
|
| signaling_thread_ = rtc::ThreadManager::Instance()->WrapCurrentThread();
|
| wraps_current_thread_ = true;
|
| }
|
| + network_thread_->Start();
|
| worker_thread_->Start();
|
| }
|
|
|
| PeerConnectionFactory::PeerConnectionFactory(
|
| + rtc::Thread* network_thread,
|
| rtc::Thread* worker_thread,
|
| rtc::Thread* signaling_thread,
|
| AudioDeviceModule* default_adm,
|
| @@ -121,13 +122,15 @@ PeerConnectionFactory::PeerConnectionFactory(
|
| cricket::WebRtcVideoDecoderFactory* video_decoder_factory)
|
| : owns_ptrs_(false),
|
| wraps_current_thread_(false),
|
| - signaling_thread_(signaling_thread),
|
| + network_thread_(network_thread),
|
| worker_thread_(worker_thread),
|
| + signaling_thread_(signaling_thread),
|
| default_adm_(default_adm),
|
| video_encoder_factory_(video_encoder_factory),
|
| video_decoder_factory_(video_decoder_factory) {
|
| - ASSERT(worker_thread != NULL);
|
| - ASSERT(signaling_thread != NULL);
|
| + RTC_DCHECK(network_thread);
|
| + RTC_DCHECK(worker_thread);
|
| + RTC_DCHECK(signaling_thread);
|
| // TODO: Currently there is no way creating an external adm in
|
| // libjingle source tree. So we can 't currently assert if this is NULL.
|
| // ASSERT(default_adm != NULL);
|
| @@ -148,6 +151,7 @@ PeerConnectionFactory::~PeerConnectionFactory() {
|
| if (wraps_current_thread_)
|
| rtc::ThreadManager::Instance()->UnwrapCurrentThread();
|
| delete worker_thread_;
|
| + delete network_thread_;
|
| }
|
| }
|
|
|
| @@ -161,7 +165,7 @@ bool PeerConnectionFactory::Initialize() {
|
| }
|
|
|
| default_socket_factory_.reset(
|
| - new rtc::BasicPacketSocketFactory(worker_thread_));
|
| + new rtc::BasicPacketSocketFactory(network_thread_));
|
| if (!default_socket_factory_) {
|
| return false;
|
| }
|
| @@ -172,17 +176,16 @@ bool PeerConnectionFactory::Initialize() {
|
| worker_thread_->Invoke<cricket::MediaEngineInterface*>(rtc::Bind(
|
| &PeerConnectionFactory::CreateMediaEngine_w, this));
|
|
|
| - rtc::Thread* const network_thread = worker_thread_;
|
| channel_manager_.reset(new cricket::ChannelManager(
|
| - media_engine, worker_thread_, network_thread));
|
| + media_engine, worker_thread_, network_thread_));
|
|
|
| channel_manager_->SetVideoRtxEnabled(true);
|
| if (!channel_manager_->Init()) {
|
| return false;
|
| }
|
|
|
| - dtls_identity_store_ = new RefCountedDtlsIdentityStore(
|
| - signaling_thread_, worker_thread_);
|
| + dtls_identity_store_ =
|
| + new RefCountedDtlsIdentityStore(signaling_thread_, network_thread_);
|
|
|
| return true;
|
| }
|
| @@ -340,6 +343,10 @@ rtc::Thread* PeerConnectionFactory::worker_thread() {
|
| return worker_thread_;
|
| }
|
|
|
| +rtc::Thread* PeerConnectionFactory::network_thread() {
|
| + return network_thread_;
|
| +}
|
| +
|
| cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() {
|
| ASSERT(worker_thread_ == rtc::Thread::Current());
|
| return cricket::WebRtcMediaEngineFactory::Create(
|
|
|