Only use PortAllocator on the network thread.
A previous CL started only using it on the worker thread, but it was
written before the network thread was introduced.
Review-Url: https://codereview.webrtc.org/1987093002
Cr-Original-Commit-Position: refs/heads/master@{#12802}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 91dd567feafdf832e8d0a47abec01def869d4f2b
diff --git a/api/peerconnection.cc b/api/peerconnection.cc
index dda0eeb..581159f 100644
--- a/api/peerconnection.cc
+++ b/api/peerconnection.cc
@@ -559,8 +559,8 @@
// because its destruction fires signals (such as VoiceChannelDestroyed)
// which will trigger some final actions in PeerConnection...
session_.reset(nullptr);
- // port_allocator_ lives on the worker thread and should be destroyed there.
- worker_thread()->Invoke<void>([this] { port_allocator_.reset(nullptr); });
+ // port_allocator_ lives on the network thread and should be destroyed there.
+ network_thread()->Invoke<void>([this] { port_allocator_.reset(nullptr); });
}
bool PeerConnection::Initialize(
@@ -577,10 +577,10 @@
port_allocator_ = std::move(allocator);
- // The port allocator lives on the worker thread and should be initialized
+ // The port allocator lives on the network thread and should be initialized
// there.
- if (!worker_thread()->Invoke<bool>(rtc::Bind(
- &PeerConnection::InitializePortAllocator_w, this, configuration))) {
+ if (!network_thread()->Invoke<bool>(rtc::Bind(
+ &PeerConnection::InitializePortAllocator_n, this, configuration))) {
return false;
}
@@ -1164,8 +1164,8 @@
bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration) {
TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration");
if (port_allocator_) {
- if (!worker_thread()->Invoke<bool>(
- rtc::Bind(&PeerConnection::ReconfigurePortAllocator_w, this,
+ if (!network_thread()->Invoke<bool>(
+ rtc::Bind(&PeerConnection::ReconfigurePortAllocator_n, this,
configuration))) {
return false;
}
@@ -2088,7 +2088,7 @@
return nullptr;
}
-bool PeerConnection::InitializePortAllocator_w(
+bool PeerConnection::InitializePortAllocator_n(
const RTCConfiguration& configuration) {
cricket::ServerAddresses stun_servers;
std::vector<cricket::RelayServerConfig> turn_servers;
@@ -2128,7 +2128,7 @@
return true;
}
-bool PeerConnection::ReconfigurePortAllocator_w(
+bool PeerConnection::ReconfigurePortAllocator_n(
const RTCConfiguration& configuration) {
cricket::ServerAddresses stun_servers;
std::vector<cricket::RelayServerConfig> turn_servers;
diff --git a/api/peerconnection.h b/api/peerconnection.h
index 8ba7e58..cf9e3b9 100644
--- a/api/peerconnection.h
+++ b/api/peerconnection.h
@@ -209,7 +209,7 @@
return factory_->signaling_thread();
}
- rtc::Thread* worker_thread() const { return factory_->worker_thread(); }
+ rtc::Thread* network_thread() const { return factory_->network_thread(); }
void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
const std::string& error);
@@ -353,10 +353,10 @@
DataChannel* FindDataChannelBySid(int sid) const;
// Called when first configuring the port allocator.
- bool InitializePortAllocator_w(const RTCConfiguration& configuration);
+ bool InitializePortAllocator_n(const RTCConfiguration& configuration);
// Called when SetConfiguration is called. Only a subset of the configuration
// is applied.
- bool ReconfigurePortAllocator_w(const RTCConfiguration& configuration);
+ bool ReconfigurePortAllocator_n(const RTCConfiguration& configuration);
// Storing the factory as a scoped reference pointer ensures that the memory
// in the PeerConnectionFactoryImpl remains available as long as the
diff --git a/api/peerconnectionfactory.cc b/api/peerconnectionfactory.cc
index 9cb5b46..a91589a 100644
--- a/api/peerconnectionfactory.cc
+++ b/api/peerconnectionfactory.cc
@@ -287,7 +287,7 @@
allocator.reset(new cricket::BasicPortAllocator(
default_network_manager_.get(), default_socket_factory_.get()));
}
- worker_thread_->Invoke<void>(
+ network_thread_->Invoke<void>(
rtc::Bind(&cricket::PortAllocator::SetNetworkIgnoreMask, allocator.get(),
options_.network_ignore_mask));