From 3496ef108703b8b3883cadfa4fd9456d7d16ffda Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Tue, 28 May 2013 08:36:02 +0000 Subject: [PATCH] Improve vie_autotest_rtp_rtcp by reenabling important tests and reducing flakiness. R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1567004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4118 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../auto_test/source/vie_autotest_rtp_rtcp.cc | 89 ++++++++++++------- .../testbed/tb_external_transport.cc | 2 +- 2 files changed, 57 insertions(+), 34 deletions(-) diff --git a/webrtc/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc b/webrtc/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc index fbaaca104..00a627844 100644 --- a/webrtc/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc +++ b/webrtc/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc @@ -246,8 +246,8 @@ void ViEAutoTest::ViERtpRtcpStandardTest() EXPECT_EQ(0, ViE.rtp_rtcp->SetStartSequenceNumber( tbChannel.videoChannel, startSequenceNumber)); - EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel)); EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel)); + EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel)); AutoTestSleep(kAutoTestSleepTimeMs); @@ -432,39 +432,59 @@ void ViEAutoTest::ViERtpRtcpStandardTest() EXPECT_EQ(0, ViE.rtp_rtcp->SetNACKStatus(tbChannel.videoChannel, true)); EXPECT_EQ(0, ViE.rtp_rtcp->SetTransmissionSmoothingStatus( tbChannel.videoChannel, true)); + unsigned int bytes_sent_before = 0; + unsigned int packets_sent_before = 0; + unsigned int bytes_received_before = 0; + unsigned int packets_received_before = 0; + unsigned int bytes_sent_after = 0; + unsigned int packets_sent_after = 0; + unsigned int bytes_received_after = 0; + unsigned int packets_received_after = 0; + EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel, + bytes_sent_before, + packets_sent_before, + bytes_received_before, + packets_received_before)); EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel)); EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel)); // Real-time mode. AutoTestSleep(kAutoTestSleepTimeMs); - EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage( - tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate, - sentFecBitrate, sentNackBitrate)); + EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel, + bytes_sent_after, + packets_sent_after, + bytes_received_after, + packets_received_after)); if (FLAGS_include_timing_dependent_tests) { - EXPECT_GT(sentTotalBitrate, 0u); + EXPECT_GT(bytes_received_after, bytes_received_before); } + bytes_received_before = bytes_received_after; // Simulate lost reception and verify that nothing is sent during that time. ViE.network->SetNetworkTransmissionState(tbChannel.videoChannel, false); ViETest::Log("Network Down...\n"); AutoTestSleep(kAutoTestSleepTimeMs); - EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage( - tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate, - sentFecBitrate, sentNackBitrate)); + EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel, + bytes_sent_after, + packets_sent_after, + bytes_received_after, + packets_received_after)); if (FLAGS_include_timing_dependent_tests) { - EXPECT_EQ(sentTotalBitrate, 0u); + EXPECT_EQ(bytes_received_before, bytes_received_after); } // Network reception back. Video should now be sent. ViE.network->SetNetworkTransmissionState(tbChannel.videoChannel, true); ViETest::Log("Network Up...\n"); AutoTestSleep(kAutoTestSleepTimeMs); - EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage( - tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate, - sentFecBitrate, sentNackBitrate)); + EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel, + bytes_sent_before, + packets_sent_before, + bytes_received_before, + packets_received_before)); if (FLAGS_include_timing_dependent_tests) { - EXPECT_GT(sentTotalBitrate, 0u); + EXPECT_GT(bytes_received_before, bytes_received_after); } - + bytes_received_after = bytes_received_before; // Buffering mode. EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel)); EXPECT_EQ(0, ViE.base->StopReceive(tbChannel.videoChannel)); @@ -478,34 +498,37 @@ void ViEAutoTest::ViERtpRtcpStandardTest() EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel)); EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel)); AutoTestSleep(kAutoTestSleepTimeMs); - EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage( - tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate, - sentFecBitrate, sentNackBitrate)); - if (FLAGS_include_timing_dependent_tests) { - EXPECT_GT(sentTotalBitrate, 0u); - } // Simulate lost reception and verify that nothing is sent during that time. ViETest::Log("Network Down...\n"); ViE.network->SetNetworkTransmissionState(tbChannel.videoChannel, false); + EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel, + bytes_sent_before, + packets_sent_before, + bytes_received_before, + packets_received_before)); + if (FLAGS_include_timing_dependent_tests) { + EXPECT_GT(bytes_received_before, bytes_received_after); + } AutoTestSleep(kAutoTestSleepTimeMs); - EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage( - tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate, - sentFecBitrate, sentNackBitrate)); -// TODO(pwestin): This is incorrect due to the fact that we measure the bitrate -// before the pacer and not after. -// -// if (FLAGS_include_timing_dependent_tests) { -// EXPECT_EQ(sentTotalBitrate, 0u); -// } + EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel, + bytes_sent_after, + packets_sent_after, + bytes_received_after, + packets_received_after)); + if (FLAGS_include_timing_dependent_tests) { + EXPECT_EQ(bytes_received_after, bytes_received_before); + } // Network reception back. Video should now be sent. ViETest::Log("Network Up...\n"); ViE.network->SetNetworkTransmissionState(tbChannel.videoChannel, true); AutoTestSleep(kAutoTestSleepTimeMs); - EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage( - tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate, - sentFecBitrate, sentNackBitrate)); + EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel, + bytes_sent_before, + packets_sent_before, + bytes_received_before, + packets_received_before)); if (FLAGS_include_timing_dependent_tests) { - EXPECT_GT(sentTotalBitrate, 0u); + EXPECT_GT(bytes_received_before, bytes_received_after); } // TODO(holmer): Verify that the decoded framerate doesn't decrease on an // outage when in buffering mode. This isn't currently possible because we diff --git a/webrtc/video_engine/test/libvietest/testbed/tb_external_transport.cc b/webrtc/video_engine/test/libvietest/testbed/tb_external_transport.cc index ed891ac6c..5bdf81cf7 100644 --- a/webrtc/video_engine/test/libvietest/testbed/tb_external_transport.cc +++ b/webrtc/video_engine/test/libvietest/testbed/tb_external_transport.cc @@ -226,7 +226,7 @@ int TbExternalTransport::SendPacket(int channel, const void *data, int len) _statCrit.Enter(); _dropCount++; _statCrit.Leave(); - return 0; + return len; } VideoPacket* newPacket = new VideoPacket();