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

Unified Diff: webrtc/pc/peerconnection.cc

Issue 2717893003: Making candidate pool size behave as decided in JSEP. (Closed)
Patch Set: Merge with master Created 3 years, 9 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/client/basicportallocator.cc ('k') | webrtc/pc/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/peerconnection.cc
diff --git a/webrtc/pc/peerconnection.cc b/webrtc/pc/peerconnection.cc
index 48ffebe222d1c6482d81e27d244ee6f4e79dbc25..2c8c97886402a89fca049badd75bc7fe245aa106 100644
--- a/webrtc/pc/peerconnection.cc
+++ b/webrtc/pc/peerconnection.cc
@@ -1259,10 +1259,24 @@ void PeerConnection::SetLocalDescription(
signaling_thread()->Post(RTC_FROM_HERE, this,
MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
+ // According to JSEP, after setLocalDescription, changing the candidate pool
+ // size is not allowed, and changing the set of ICE servers will not result
+ // in new candidates being gathered.
+ port_allocator_->FreezeCandidatePool();
+
// MaybeStartGathering needs to be called after posting
// MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates
// before signaling that SetLocalDescription completed.
session_->MaybeStartGathering();
+
+ if (desc->type() == SessionDescriptionInterface::kAnswer) {
+ // TODO(deadbeef): We already had to hop to the network thread for
+ // MaybeStartGathering...
+ network_thread()->Invoke<void>(
+ RTC_FROM_HERE,
+ rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool,
+ port_allocator_.get()));
+ }
}
void PeerConnection::SetRemoteDescription(
@@ -1373,6 +1387,15 @@ void PeerConnection::SetRemoteDescription(
SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
signaling_thread()->Post(RTC_FROM_HERE, this,
MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
+
+ if (desc->type() == SessionDescriptionInterface::kAnswer) {
+ // TODO(deadbeef): We already had to hop to the network thread for
+ // MaybeStartGathering...
+ network_thread()->Invoke<void>(
+ RTC_FROM_HERE,
+ rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool,
+ port_allocator_.get()));
+ }
}
PeerConnectionInterface::RTCConfiguration PeerConnection::GetConfiguration() {
@@ -1538,6 +1561,10 @@ void PeerConnection::Close() {
session_->Close();
event_log_.reset();
+ network_thread()->Invoke<void>(
+ RTC_FROM_HERE,
+ rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool,
+ port_allocator_.get()));
}
void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/,
« no previous file with comments | « webrtc/p2p/client/basicportallocator.cc ('k') | webrtc/pc/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698