Index: webrtc/call/call_unittest.cc |
diff --git a/webrtc/call/call_unittest.cc b/webrtc/call/call_unittest.cc |
index 2524de6d19b1ef794077d43225ca03135d5cc43f..23a53f67ef2b4a6d5c83d328b3c727a745d0aae6 100644 |
--- a/webrtc/call/call_unittest.cc |
+++ b/webrtc/call/call_unittest.cc |
@@ -23,6 +23,7 @@ |
#include "webrtc/modules/congestion_controller/include/mock/mock_send_side_congestion_controller.h" |
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
#include "webrtc/rtc_base/ptr_util.h" |
+#include "webrtc/test/fake_encoder.h" |
#include "webrtc/test/gtest.h" |
#include "webrtc/test/mock_audio_decoder_factory.h" |
#include "webrtc/test/mock_transport.h" |
@@ -318,6 +319,42 @@ TEST(CallTest, MultipleFlexfecReceiveStreamsProtectingSingleVideoStream) { |
} |
} |
+TEST(CallTest, DontAllowKeepaliveReconfiguration) { |
+ CallHelper call; |
+ webrtc::RtpKeepAliveConfig keep_alive_config; |
+ |
+ // Set default values, shouldn't be a problem. |
+ EXPECT_TRUE(call->SetRtpKeepAliveConfig(keep_alive_config)); |
+ |
+ // Active keep-alive by setting a non-zero timeout. |
+ keep_alive_config.timeout_interval_ms = 15000; |
+ EXPECT_TRUE(call->SetRtpKeepAliveConfig(keep_alive_config)); |
+ |
+ // Create a minimal send stream. |
+ MockTransport transport; |
+ VideoSendStream::Config send_stream_config(&transport); |
+ test::FakeEncoder fake_encoder(Clock::GetRealTimeClock()); |
+ send_stream_config.encoder_settings.payload_name = "VP8"; |
+ send_stream_config.encoder_settings.payload_type = 100; |
+ send_stream_config.encoder_settings.encoder = &fake_encoder; |
+ send_stream_config.rtp.ssrcs.push_back(1234); |
+ VideoEncoderConfig encoder_config; |
+ VideoSendStream* const stream = call->CreateVideoSendStream( |
+ std::move(send_stream_config), encoder_config.Copy()); |
+ |
+ // Setting the keep-alive with the current values is OK (ignored). |
+ EXPECT_TRUE(call->SetRtpKeepAliveConfig(keep_alive_config)); |
+ |
+ // Updating to a new interval is disallowed. |
+ keep_alive_config.timeout_interval_ms = 1000; |
+ EXPECT_FALSE(call->SetRtpKeepAliveConfig(keep_alive_config)); |
+ |
+ // Destroyg the video send stream, with active streams it's again OK to set |
+ // a new keep-alive config. |
+ call->DestroyVideoSendStream(stream); |
+ EXPECT_TRUE(call->SetRtpKeepAliveConfig(keep_alive_config)); |
+} |
+ |
namespace { |
struct CallBitrateHelper { |
CallBitrateHelper() : CallBitrateHelper(Call::Config::BitrateConfig()) {} |