From d2702ef1108e9bd144738a69bcf4deb7edc57341 Mon Sep 17 00:00:00 2001 From: sprang Date: Mon, 10 Jul 2017 08:41:10 -0700 Subject: [PATCH] Fix flaky test VideoSendStreamTest.SendsKeepAlive Since the keep-alive payload type is not registered in the payload type map of FakeNetworkPipe, it will cause a DCHECK to trigger unless we're able to destroy the call before that. Just register it in the fake network as media type "any", it will be discarded early on the receive side anyway. BUG=webrt:7964 Review-Url: https://codereview.webrtc.org/2979543002 Cr-Commit-Position: refs/heads/master@{#18953} --- webrtc/test/call_test.cc | 6 +++++- webrtc/test/call_test.h | 1 + webrtc/video/video_send_stream_tests.cc | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/webrtc/test/call_test.cc b/webrtc/test/call_test.cc index fc3fc689f2..c1db322bd8 100644 --- a/webrtc/test/call_test.cc +++ b/webrtc/test/call_test.cc @@ -437,6 +437,9 @@ const uint32_t CallTest::kReceiverLocalVideoSsrc = 0x123456; const uint32_t CallTest::kReceiverLocalAudioSsrc = 0x1234567; const int CallTest::kNackRtpHistoryMs = 1000; +const uint8_t CallTest::kDefaultKeepalivePayloadType = + RtpKeepAliveConfig().payload_type; + const std::map CallTest::payload_type_map_ = { {CallTest::kVideoSendPayloadType, MediaType::VIDEO}, {CallTest::kFakeVideoSendPayloadType, MediaType::VIDEO}, @@ -445,7 +448,8 @@ const std::map CallTest::payload_type_map_ = { {CallTest::kRtxRedPayloadType, MediaType::VIDEO}, {CallTest::kUlpfecPayloadType, MediaType::VIDEO}, {CallTest::kFlexfecPayloadType, MediaType::VIDEO}, - {CallTest::kAudioSendPayloadType, MediaType::AUDIO}}; + {CallTest::kAudioSendPayloadType, MediaType::AUDIO}, + {CallTest::kDefaultKeepalivePayloadType, MediaType::ANY}}; BaseTest::BaseTest() : event_log_(RtcEventLog::CreateNull()) {} diff --git a/webrtc/test/call_test.h b/webrtc/test/call_test.h index e7b75d6671..215d8aa431 100644 --- a/webrtc/test/call_test.h +++ b/webrtc/test/call_test.h @@ -57,6 +57,7 @@ class CallTest : public ::testing::Test { static const uint32_t kReceiverLocalVideoSsrc; static const uint32_t kReceiverLocalAudioSsrc; static const int kNackRtpHistoryMs; + static const uint8_t kDefaultKeepalivePayloadType; static const std::map payload_type_map_; protected: diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc index 3206c40587..aa9d2fb093 100644 --- a/webrtc/video/video_send_stream_tests.cc +++ b/webrtc/video/video_send_stream_tests.cc @@ -3410,7 +3410,6 @@ TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) { TEST_F(VideoSendStreamTest, SendsKeepAlive) { const int kTimeoutMs = 50; // Really short timeout for testing. - const int kPayloadType = 20; class KeepaliveObserver : public test::SendTest { public: @@ -3421,7 +3420,7 @@ TEST_F(VideoSendStreamTest, SendsKeepAlive) { RTPHeader header; EXPECT_TRUE(parser_->Parse(packet, length, &header)); - if (header.payloadType != kPayloadType) { + if (header.payloadType != CallTest::kDefaultKeepalivePayloadType) { // The video stream has started. Stop it now. if (capturer_) capturer_->Stop(); @@ -3437,7 +3436,8 @@ TEST_F(VideoSendStreamTest, SendsKeepAlive) { std::vector* receive_configs, VideoEncoderConfig* encoder_config) override { send_config->rtp.keep_alive.timeout_interval_ms = kTimeoutMs; - send_config->rtp.keep_alive.payload_type = kPayloadType; + send_config->rtp.keep_alive.payload_type = + CallTest::kDefaultKeepalivePayloadType; } void PerformTest() override {