Don't allow changing ICE pool size after SetLocalDescription.
This was the decision at IETF 97
(see: https://github.com/rtcweb-wg/jsep/issues/381). It's simpler to not
allow this (since there's no real need for it) rather than try to decide
complex rules for it.
BUG=webrtc:6864
Review-Url: https://codereview.webrtc.org/2566833002
Cr-Commit-Position: refs/heads/master@{#15559}
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index 692ca2e..05a940e 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -1288,6 +1288,14 @@
bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration) {
TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration");
+
+ if (session_->local_description() &&
+ configuration.ice_candidate_pool_size !=
+ configuration_.ice_candidate_pool_size) {
+ LOG(LS_ERROR) << "Can't change candidate pool size after calling "
+ "SetLocalDescription.";
+ return false;
+ }
// TODO(deadbeef): Return false and log an error if there are any unsupported
// modifications.
if (port_allocator_) {
@@ -1295,6 +1303,7 @@
RTC_FROM_HERE,
rtc::Bind(&PeerConnection::ReconfigurePortAllocator_n, this,
configuration))) {
+ LOG(LS_ERROR) << "Failed to apply configuration to PortAllocator.";
return false;
}
}
@@ -2386,10 +2395,9 @@
ConvertIceTransportTypeToCandidateFilter(configuration.type));
// Call this last since it may create pooled allocator sessions using the
// candidate filter set above.
- port_allocator_->SetConfiguration(stun_servers, turn_servers,
- configuration.ice_candidate_pool_size,
- configuration.prune_turn_ports);
- return true;
+ return port_allocator_->SetConfiguration(
+ stun_servers, turn_servers, configuration.ice_candidate_pool_size,
+ configuration.prune_turn_ports);
}
bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,