From d1f5fdac5c24204bb90594b81492c33d4acfcc62 Mon Sep 17 00:00:00 2001 From: skvlad Date: Fri, 3 Feb 2017 16:54:05 -0800 Subject: [PATCH] Allow changing the minimal ICE ping timeout with PeerConnection.SetConfiguration. The original CL (https://codereview.webrtc.org/2670053002) only allows it to be set at PeerConnection creation time. BUG=webrtc:7082 Review-Url: https://codereview.webrtc.org/2677503004 Cr-Commit-Position: refs/heads/master@{#16436} --- webrtc/pc/peerconnection.cc | 7 +++++++ webrtc/pc/peerconnectioninterface_unittest.cc | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/webrtc/pc/peerconnection.cc b/webrtc/pc/peerconnection.cc index 14d2e94572..ba21429d85 100644 --- a/webrtc/pc/peerconnection.cc +++ b/webrtc/pc/peerconnection.cc @@ -1419,6 +1419,7 @@ bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration, modified_config.ice_candidate_pool_size = configuration.ice_candidate_pool_size; modified_config.prune_turn_ports = configuration.prune_turn_ports; + modified_config.ice_check_min_interval = configuration.ice_check_min_interval; if (configuration != modified_config) { LOG(LS_ERROR) << "Modifying the configuration in an unsupported way."; return SafeSetError(RTCErrorType::INVALID_MODIFICATION, error); @@ -1459,6 +1460,12 @@ bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration, modified_config.prune_turn_ports != configuration_.prune_turn_ports) { session_->SetNeedsIceRestartFlag(); } + + if (modified_config.ice_check_min_interval != + configuration_.ice_check_min_interval) { + session_->SetIceConfig(session_->ParseIceConfig(modified_config)); + } + configuration_ = modified_config; return SafeSetError(RTCErrorType::NONE, error); } diff --git a/webrtc/pc/peerconnectioninterface_unittest.cc b/webrtc/pc/peerconnectioninterface_unittest.cc index c2e6e186e4..90f4854990 100644 --- a/webrtc/pc/peerconnectioninterface_unittest.cc +++ b/webrtc/pc/peerconnectioninterface_unittest.cc @@ -2221,6 +2221,20 @@ TEST_F(PeerConnectionInterfaceTest, SetConfigurationChangesPruneTurnPortsFlag) { EXPECT_TRUE(port_allocator_->prune_turn_ports()); } +// Test that the ice check interval can be changed. This does not verify that +// the setting makes it all the way to P2PTransportChannel, as that would +// require a very complex set of mocks. +TEST_F(PeerConnectionInterfaceTest, SetConfigurationChangesIceCheckInterval) { + PeerConnectionInterface::RTCConfiguration config; + config.ice_check_min_interval = rtc::Optional(); + CreatePeerConnection(config, nullptr); + config.ice_check_min_interval = rtc::Optional(100); + EXPECT_TRUE(pc_->SetConfiguration(config)); + PeerConnectionInterface::RTCConfiguration new_config = + pc_->GetConfiguration(); + EXPECT_EQ(new_config.ice_check_min_interval, rtc::Optional(100)); +} + // Test that when SetConfiguration changes both the pool size and other // attributes, the pooled session is created with the updated attributes. TEST_F(PeerConnectionInterfaceTest,