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

Unified Diff: webrtc/pc/peerconnection.cc

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
Index: webrtc/pc/peerconnection.cc
diff --git a/webrtc/pc/peerconnection.cc b/webrtc/pc/peerconnection.cc
index 96e2b339a49d25faa32e449b2944c362b27c946a..750d821ff3da84be091c3ee9fc99fffe6873ef79 100644
--- a/webrtc/pc/peerconnection.cc
+++ b/webrtc/pc/peerconnection.cc
@@ -1280,10 +1280,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::DiscardPooledSessions,
+ port_allocator_.get()));
+ }
}
void PeerConnection::SetRemoteDescription(
@@ -1394,6 +1408,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::DiscardPooledSessions,
+ port_allocator_.get()));
+ }
}
PeerConnectionInterface::RTCConfiguration PeerConnection::GetConfiguration() {
@@ -1559,6 +1582,10 @@ void PeerConnection::Close() {
session_->Close();
event_log_.reset();
+ network_thread()->Invoke<void>(
+ RTC_FROM_HERE,
+ rtc::Bind(&cricket::PortAllocator::DiscardPooledSessions,
+ port_allocator_.get()));
}
void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/,

Powered by Google App Engine
This is Rietveld 408576698