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

Unified Diff: webrtc/p2p/base/portallocator.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/p2p/base/portallocator.h ('k') | webrtc/p2p/base/portallocator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/portallocator.cc
diff --git a/webrtc/p2p/base/portallocator.cc b/webrtc/p2p/base/portallocator.cc
index fdf213b31198abed093a4f6d1c3bc98ccddee3e7..5c4243abf6b66e07c845448c24eed398e49edd02 100644
--- a/webrtc/p2p/base/portallocator.cc
+++ b/webrtc/p2p/base/portallocator.cc
@@ -18,85 +18,23 @@
const std::string& ice_ufrag,
const std::string& ice_pwd,
uint32_t flags)
- : flags_(flags),
+ : content_name_(content_name),
+ component_(component),
+ flags_(flags),
generation_(0),
- content_name_(content_name),
- component_(component),
ice_ufrag_(ice_ufrag),
ice_pwd_(ice_pwd) {
- // Pooled sessions are allowed to be created with empty content name,
- // component, ufrag and password.
- RTC_DCHECK(ice_ufrag.empty() == ice_pwd.empty());
+ RTC_DCHECK(!ice_ufrag.empty());
+ RTC_DCHECK(!ice_pwd.empty());
}
-void PortAllocator::SetConfiguration(
- const ServerAddresses& stun_servers,
- const std::vector<RelayServerConfig>& turn_servers,
- int candidate_pool_size) {
- bool ice_servers_changed =
- (stun_servers != stun_servers_ || turn_servers != turn_servers_);
- stun_servers_ = stun_servers;
- turn_servers_ = turn_servers;
-
- // If ICE servers changed, throw away any existing pooled sessions and create
- // new ones.
- if (ice_servers_changed) {
- pooled_sessions_.clear();
- allocated_pooled_session_count_ = 0;
- }
-
- // If |size| is less than the number of allocated sessions, get rid of the
- // extras.
- while (allocated_pooled_session_count_ > candidate_pool_size &&
- !pooled_sessions_.empty()) {
- pooled_sessions_.front().reset(nullptr);
- pooled_sessions_.pop_front();
- --allocated_pooled_session_count_;
- }
- // If |size| is greater than the number of allocated sessions, create new
- // sessions.
- while (allocated_pooled_session_count_ < candidate_pool_size) {
- PortAllocatorSession* pooled_session = CreateSessionInternal("", 0, "", "");
- pooled_session->StartGettingPorts();
- pooled_sessions_.push_back(
- std::unique_ptr<PortAllocatorSession>(pooled_session));
- ++allocated_pooled_session_count_;
- }
- target_pooled_session_count_ = candidate_pool_size;
-}
-
-std::unique_ptr<PortAllocatorSession> PortAllocator::CreateSession(
+PortAllocatorSession* PortAllocator::CreateSession(
const std::string& sid,
const std::string& content_name,
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd) {
- return std::unique_ptr<PortAllocatorSession>(
- CreateSessionInternal(content_name, component, ice_ufrag, ice_pwd));
-}
-
-std::unique_ptr<PortAllocatorSession> PortAllocator::TakePooledSession(
- const std::string& content_name,
- int component,
- const std::string& ice_ufrag,
- const std::string& ice_pwd) {
- RTC_DCHECK(!ice_ufrag.empty());
- RTC_DCHECK(!ice_pwd.empty());
- if (pooled_sessions_.empty()) {
- return nullptr;
- }
- std::unique_ptr<PortAllocatorSession> ret =
- std::move(pooled_sessions_.front());
- ret->SetIceParameters(content_name, component, ice_ufrag, ice_pwd);
- pooled_sessions_.pop_front();
- return ret;
-}
-
-const PortAllocatorSession* PortAllocator::GetPooledSession() const {
- if (pooled_sessions_.empty()) {
- return nullptr;
- }
- return pooled_sessions_.front().get();
+ return CreateSessionInternal(content_name, component, ice_ufrag, ice_pwd);
}
} // namespace cricket
« no previous file with comments | « webrtc/p2p/base/portallocator.h ('k') | webrtc/p2p/base/portallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698