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

Unified Diff: webrtc/p2p/base/p2ptransportchannel.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/p2ptransportchannel.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 2801c446461679011e091ccd5fd5af46dcb81cdf..206113c4ebcc554d9b401e716c5031412eda4845 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -261,27 +261,30 @@
P2PTransportChannel::~P2PTransportChannel() {
ASSERT(worker_thread_ == rtc::Thread::Current());
+
+ for (size_t i = 0; i < allocator_sessions_.size(); ++i)
+ delete allocator_sessions_[i];
}
// Add the allocator session to our list so that we know which sessions
// are still active.
-void P2PTransportChannel::AddAllocatorSession(
- std::unique_ptr<PortAllocatorSession> session) {
+void P2PTransportChannel::AddAllocatorSession(PortAllocatorSession* session) {
ASSERT(worker_thread_ == rtc::Thread::Current());
session->set_generation(static_cast<uint32_t>(allocator_sessions_.size()));
+ allocator_sessions_.push_back(session);
+
+ // We now only want to apply new candidates that we receive to the ports
+ // created by this new session because these are replacing those of the
+ // previous sessions.
+ ports_.clear();
+
session->SignalPortReady.connect(this, &P2PTransportChannel::OnPortReady);
session->SignalCandidatesReady.connect(
this, &P2PTransportChannel::OnCandidatesReady);
session->SignalCandidatesAllocationDone.connect(
this, &P2PTransportChannel::OnCandidatesAllocationDone);
-
- // We now only want to apply new candidates that we receive to the ports
- // created by this new session because these are replacing those of the
- // previous sessions.
- ports_.clear();
-
- allocator_sessions_.push_back(std::move(session));
+ session->StartGettingPorts();
}
void P2PTransportChannel::AddConnection(Connection* connection) {
@@ -469,28 +472,9 @@
gathering_state_ = kIceGatheringGathering;
SignalGatheringState(this);
}
- // Time for a new allocator.
- std::unique_ptr<PortAllocatorSession> pooled_session =
- allocator_->TakePooledSession(transport_name(), component(), ice_ufrag_,
- ice_pwd_);
- if (pooled_session) {
- AddAllocatorSession(std::move(pooled_session));
- PortAllocatorSession* raw_pooled_session =
- allocator_sessions_.back().get();
- // Process the pooled session's existing candidates/ports, if they exist.
- OnCandidatesReady(raw_pooled_session,
- raw_pooled_session->ReadyCandidates());
- for (PortInterface* port : allocator_sessions_.back()->ReadyPorts()) {
- OnPortReady(raw_pooled_session, port);
- }
- if (allocator_sessions_.back()->CandidatesAllocationDone()) {
- OnCandidatesAllocationDone(raw_pooled_session);
- }
- } else {
- AddAllocatorSession(allocator_->CreateSession(
- SessionId(), transport_name(), component(), ice_ufrag_, ice_pwd_));
- allocator_sessions_.back()->StartGettingPorts();
- }
+ // Time for a new allocator
+ AddAllocatorSession(allocator_->CreateSession(
+ SessionId(), transport_name(), component(), ice_ufrag_, ice_pwd_));
}
}
@@ -1229,7 +1213,7 @@
return;
}
- for (const auto& session : allocator_sessions_) {
+ for (PortAllocatorSession* session : allocator_sessions_) {
if (!session->IsGettingPorts()) {
continue;
}
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698