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}
This commit is contained in:
sprang 2017-07-10 08:41:10 -07:00 committed by Commit Bot
parent fe53355dcb
commit d2702ef110
3 changed files with 9 additions and 4 deletions

View File

@ -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<uint8_t, MediaType> CallTest::payload_type_map_ = {
{CallTest::kVideoSendPayloadType, MediaType::VIDEO},
{CallTest::kFakeVideoSendPayloadType, MediaType::VIDEO},
@ -445,7 +448,8 @@ const std::map<uint8_t, MediaType> 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()) {}

View File

@ -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<uint8_t, MediaType> payload_type_map_;
protected:

View File

@ -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<VideoReceiveStream::Config>* 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 {