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

Unified Diff: webrtc/p2p/base/portallocator.h

Issue 2717893003: Making candidate pool size behave as decided in JSEP. (Closed)
Patch Set: Get rid of now-unnecessary test. Created 3 years, 10 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 | « no previous file | webrtc/p2p/base/portallocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/portallocator.h
diff --git a/webrtc/p2p/base/portallocator.h b/webrtc/p2p/base/portallocator.h
index 51474297f77d1726cb1333dbceca8f3c361377d1..9104da0275449a50bdd717c5cba10374e006c499 100644
--- a/webrtc/p2p/base/portallocator.h
+++ b/webrtc/p2p/base/portallocator.h
@@ -307,6 +307,7 @@ class PortAllocator : public sigslot::has_slots<> {
allow_tcp_listen_(true),
candidate_filter_(CF_ALL) {
}
+
virtual ~PortAllocator() {}
// This should be called on the PortAllocator's thread before the
@@ -316,11 +317,13 @@ class PortAllocator : public sigslot::has_slots<> {
// Set STUN and TURN servers to be used in future sessions, and set
// candidate pool size, as described in JSEP.
//
- // If the servers are changing and the candidate pool size is nonzero,
- // existing pooled sessions will be destroyed and new ones created.
+ // If the servers are changing, and the candidate pool size is nonzero, and
+ // FreezeCandidatePool hasn't been called, existing pooled sessions will be
+ // destroyed and new ones created.
//
- // If the servers are not changing but the candidate pool size is,
- // pooled sessions will be either created or destroyed as necessary.
+ // If the servers are not changing but the candidate pool size is, and
+ // FreezeCandidatePool hasn't been called, pooled sessions will be either
+ // created or destroyed as necessary.
//
// Returns true if the configuration could successfully be changed.
bool SetConfiguration(const ServerAddresses& stun_servers,
@@ -363,6 +366,18 @@ class PortAllocator : public sigslot::has_slots<> {
// Returns the next session that would be returned by TakePooledSession.
const PortAllocatorSession* GetPooledSession() const;
+ // After FreezeCandidatePool is called, changing the candidate pool size will
+ // no longer be allowed, and changing ICE servers will not cause pooled
+ // sessions to be recreated.
+ //
+ // Expected to be called when SetLocalDescription is called on a
+ // PeerConnection. Can be called safely on any thread as long as not
+ // simultaneously with SetConfiguration.
+ void FreezeCandidatePool();
+
+ // Discard any remaining pooled sessions.
+ void DiscardPooledSessions();
pthatcher1 2017/03/09 00:28:15 DiscardCandidatePool? To be consistent with Freez
Taylor Brandstetter 2017/03/09 14:59:03 Done
+
uint32_t flags() const { return flags_; }
void set_flags(uint32_t flags) { flags_ = flags; }
@@ -439,6 +454,7 @@ class PortAllocator : public sigslot::has_slots<> {
std::vector<RelayServerConfig> turn_servers_;
int candidate_pool_size_ = 0; // Last value passed into SetConfiguration.
std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_;
+ bool candidate_pool_frozen_ = false;
bool prune_turn_ports_ = false;
webrtc::MetricsObserverInterface* metrics_observer_ = nullptr;
« no previous file with comments | « no previous file | webrtc/p2p/base/portallocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698