Add additional check when setting RTCConfiguration

Check that ice_regather_interval_range is set only when continual
regathering is also set.

Bug: webrtc:7969
Change-Id: Ifcfeee744d817cf00914418d7e682f11528faf05
Reviewed-on: https://chromium-review.googlesource.com/569358
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19009}
This commit is contained in:
Steve Anton
2017-07-13 13:27:23 -07:00
committed by Commit Bot
parent 2178f700f6
commit 8110beda7f
5 changed files with 72 additions and 2 deletions

View File

@ -797,6 +797,17 @@ class PeerConnectionInterfaceTest : public testing::Test {
EXPECT_EQ(nullptr, pc);
}
void CreatePeerConnectionExpectFail(
PeerConnectionInterface::RTCConfiguration config) {
PeerConnectionInterface::IceServer server;
server.uri = kTurnIceServerUri;
server.password = kTurnPassword;
config.servers.push_back(server);
rtc::scoped_refptr<PeerConnectionInterface> pc =
pc_factory_->CreatePeerConnection(config, nullptr, nullptr, &observer_);
EXPECT_EQ(nullptr, pc);
}
void CreatePeerConnectionWithDifferentConfigurations() {
CreatePeerConnectionWithIceServer(kStunAddressOnly, "");
EXPECT_EQ(1u, port_allocator_->stun_servers().size());
@ -3399,6 +3410,28 @@ TEST_F(PeerConnectionInterfaceTest, SetBitrateMaxNegativeFails) {
EXPECT_FALSE(pc_->SetBitrate(bitrate).ok());
}
// ice_regather_interval_range requires WebRTC to be configured for continual
// gathering already.
TEST_F(PeerConnectionInterfaceTest,
SetIceRegatherIntervalRangeWithoutContinualGatheringFails) {
PeerConnectionInterface::RTCConfiguration config;
config.ice_regather_interval_range.emplace(1000, 2000);
config.continual_gathering_policy =
PeerConnectionInterface::ContinualGatheringPolicy::GATHER_ONCE;
CreatePeerConnectionExpectFail(config);
}
// Ensures that there is no error when ice_regather_interval_range is set with
// continual gathering enabled.
TEST_F(PeerConnectionInterfaceTest,
SetIceRegatherIntervalRangeWithContinualGathering) {
PeerConnectionInterface::RTCConfiguration config;
config.ice_regather_interval_range.emplace(1000, 2000);
config.continual_gathering_policy =
PeerConnectionInterface::ContinualGatheringPolicy::GATHER_CONTINUALLY;
CreatePeerConnection(config, nullptr);
}
// The current bitrate from Call's BitrateConfigMask is currently clamped by
// Call's BitrateConfig, which comes from the SDP or a default value. This test
// checks that a call to SetBitrate with a current bitrate that will be clamped