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

Unified Diff: webrtc/api/peerconnection.cc

Issue 1982513002: Revert of Relanding: Implement RTCConfiguration.iceCandidatePoolSize. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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/peerconnection.h ('k') | webrtc/api/peerconnection_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/peerconnection.cc
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index 5284db37fd7675bb65c01af4417f8a20b66783e3..506a21582f7ae0ce6f4dffa34497ac72b4dc14ee 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -376,23 +376,6 @@
}
}
-uint32_t ConvertIceTransportTypeToCandidateFilter(
- PeerConnectionInterface::IceTransportsType type) {
- switch (type) {
- case PeerConnectionInterface::kNone:
- return cricket::CF_NONE;
- case PeerConnectionInterface::kRelay:
- return cricket::CF_RELAY;
- case PeerConnectionInterface::kNoHost:
- return (cricket::CF_ALL & ~cricket::CF_HOST);
- case PeerConnectionInterface::kAll:
- return cricket::CF_ALL;
- default:
- ASSERT(false);
- }
- return cricket::CF_NONE;
-}
-
} // namespace
namespace webrtc {
@@ -553,14 +536,6 @@
for (const auto& receiver : receivers_) {
receiver->Stop();
}
- // Destroy stats_ because it depends on session_.
- stats_.reset(nullptr);
- // Now destroy session_ before destroying other members,
- // 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); });
}
bool PeerConnection::Initialize(
@@ -577,12 +552,35 @@
port_allocator_ = std::move(allocator);
- // The port allocator lives on the worker thread and should be initialized
- // there.
- if (!worker_thread()->Invoke<bool>(rtc::Bind(
- &PeerConnection::InitializePortAllocator_w, this, configuration))) {
+ cricket::ServerAddresses stun_servers;
+ std::vector<cricket::RelayServerConfig> turn_servers;
+ if (!ParseIceServers(configuration.servers, &stun_servers, &turn_servers)) {
return false;
}
+ port_allocator_->SetIceServers(stun_servers, turn_servers);
+
+ // To handle both internal and externally created port allocator, we will
+ // enable BUNDLE here.
+ int portallocator_flags = port_allocator_->flags();
+ portallocator_flags |= cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
+ cricket::PORTALLOCATOR_ENABLE_IPV6;
+ // If the disable-IPv6 flag was specified, we'll not override it
+ // by experiment.
+ if (configuration.disable_ipv6) {
+ portallocator_flags &= ~(cricket::PORTALLOCATOR_ENABLE_IPV6);
+ } else if (webrtc::field_trial::FindFullName("WebRTC-IPv6Default") ==
+ "Disabled") {
+ portallocator_flags &= ~(cricket::PORTALLOCATOR_ENABLE_IPV6);
+ }
+
+ if (configuration.tcp_candidate_policy == kTcpCandidatePolicyDisabled) {
+ portallocator_flags |= cricket::PORTALLOCATOR_DISABLE_TCP;
+ LOG(LS_INFO) << "TCP candidates are disabled.";
+ }
+
+ port_allocator_->set_flags(portallocator_flags);
+ // No step delay is used while allocating ports.
+ port_allocator_->set_step_delay(cricket::kMinimumStepDelay);
media_controller_.reset(
factory_->CreateMediaController(configuration.media_config));
@@ -1160,19 +1158,18 @@
signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
}
-bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration) {
+bool PeerConnection::SetConfiguration(const RTCConfiguration& config) {
TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration");
if (port_allocator_) {
- if (!worker_thread()->Invoke<bool>(
- rtc::Bind(&PeerConnection::ReconfigurePortAllocator_w, this,
- configuration))) {
+ cricket::ServerAddresses stun_servers;
+ std::vector<cricket::RelayServerConfig> turn_servers;
+ if (!ParseIceServers(config.servers, &stun_servers, &turn_servers)) {
return false;
}
- }
-
- // TODO(deadbeef): Shouldn't have to hop to the worker thread twice...
- session_->SetIceConfig(session_->ParseIceConfig(configuration));
- return true;
+ port_allocator_->SetIceServers(stun_servers, turn_servers);
+ }
+ session_->SetIceConfig(session_->ParseIceConfig(config));
+ return session_->SetIceTransports(config.type);
}
bool PeerConnection::AddIceCandidate(
@@ -2087,60 +2084,4 @@
return nullptr;
}
-bool PeerConnection::InitializePortAllocator_w(
- const RTCConfiguration& configuration) {
- cricket::ServerAddresses stun_servers;
- std::vector<cricket::RelayServerConfig> turn_servers;
- if (!ParseIceServers(configuration.servers, &stun_servers, &turn_servers)) {
- return false;
- }
-
- // To handle both internal and externally created port allocator, we will
- // enable BUNDLE here.
- int portallocator_flags = port_allocator_->flags();
- portallocator_flags |= cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
- cricket::PORTALLOCATOR_ENABLE_IPV6;
- // If the disable-IPv6 flag was specified, we'll not override it
- // by experiment.
- if (configuration.disable_ipv6) {
- portallocator_flags &= ~(cricket::PORTALLOCATOR_ENABLE_IPV6);
- } else if (webrtc::field_trial::FindFullName("WebRTC-IPv6Default") ==
- "Disabled") {
- portallocator_flags &= ~(cricket::PORTALLOCATOR_ENABLE_IPV6);
- }
-
- if (configuration.tcp_candidate_policy == kTcpCandidatePolicyDisabled) {
- portallocator_flags |= cricket::PORTALLOCATOR_DISABLE_TCP;
- LOG(LS_INFO) << "TCP candidates are disabled.";
- }
-
- port_allocator_->set_flags(portallocator_flags);
- // No step delay is used while allocating ports.
- port_allocator_->set_step_delay(cricket::kMinimumStepDelay);
- port_allocator_->set_candidate_filter(
- ConvertIceTransportTypeToCandidateFilter(configuration.type));
-
- // Call this last since it may create pooled allocator sessions using the
- // properties set above.
- port_allocator_->SetConfiguration(stun_servers, turn_servers,
- configuration.ice_candidate_pool_size);
- return true;
-}
-
-bool PeerConnection::ReconfigurePortAllocator_w(
- const RTCConfiguration& configuration) {
- cricket::ServerAddresses stun_servers;
- std::vector<cricket::RelayServerConfig> turn_servers;
- if (!ParseIceServers(configuration.servers, &stun_servers, &turn_servers)) {
- return false;
- }
- port_allocator_->set_candidate_filter(
- ConvertIceTransportTypeToCandidateFilter(configuration.type));
- // Call this last since it may create pooled allocator sessions using the
- // candidate filter set above.
- port_allocator_->SetConfiguration(stun_servers, turn_servers,
- configuration.ice_candidate_pool_size);
- return true;
-}
-
} // namespace webrtc
« no previous file with comments | « webrtc/api/peerconnection.h ('k') | webrtc/api/peerconnection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698