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

Unified Diff: webrtc/api/peerconnectionfactory.cc

Issue 1968393002: Propogate network-worker thread split to api (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase including nits Created 4 years, 7 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
« no previous file with comments | « webrtc/api/peerconnectionfactory.h ('k') | webrtc/api/peerconnectionfactory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « webrtc/api/peerconnectionfactory.h ('k') | webrtc/api/peerconnectionfactory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698