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/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc
index 1fb3a5f..7b33c0c 100644
--- a/webrtc/api/peerconnectioninterface_unittest.cc
+++ b/webrtc/api/peerconnectioninterface_unittest.cc
@@ -2203,6 +2203,26 @@
EXPECT_EQ(1UL, session->stun_servers().size());
}
+// Test that after SetLocalDescription, changing the pool size is not allowed.
+TEST_F(PeerConnectionInterfaceTest,
+ CantChangePoolSizeAfterSetLocalDescription) {
+ CreatePeerConnection();
+ // Start by setting a size of 1.
+ PeerConnectionInterface::RTCConfiguration config;
+ config.ice_candidate_pool_size = 1;
+ EXPECT_TRUE(pc_->SetConfiguration(config));
+
+ // Set remote offer; can still change pool size at this point.
+ CreateOfferAsRemoteDescription();
+ config.ice_candidate_pool_size = 2;
+ EXPECT_TRUE(pc_->SetConfiguration(config));
+
+ // Set local answer; now it's too late.
+ CreateAnswerAsLocalDescription();
+ config.ice_candidate_pool_size = 3;
+ EXPECT_FALSE(pc_->SetConfiguration(config));
+}
+
// Test that PeerConnection::Close changes the states to closed and all remote
// tracks change state to ended.
TEST_F(PeerConnectionInterfaceTest, CloseAndTestStreamsAndStates) {