Add test for dropping repeated NTP timestamps.

Regression test for enforcing that frames with repeated or old NTP
timestamps are dropped.

BUG=chromium:480953, webrtc:4615
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1220193002

Cr-Commit-Position: refs/heads/master@{#9533}
This commit is contained in:
pbos
2015-07-02 04:14:46 -07:00
committed by Commit bot
parent f4eca64596
commit db0cf7624e

View File

@ -139,7 +139,7 @@ TEST_F(VideoCaptureInputTest, DoesNotRetainHandleNorCopyBuffer) {
}
TEST_F(VideoCaptureInputTest, TestNtpTimeStampSetIfRenderTimeSet) {
input_frames_.push_back(CreateVideoFrame(static_cast<uint8_t>(0)));
input_frames_.push_back(CreateVideoFrame(0));
input_frames_[0]->set_render_time_ms(5);
input_frames_[0]->set_ntp_time_ms(0);
@ -150,7 +150,7 @@ TEST_F(VideoCaptureInputTest, TestNtpTimeStampSetIfRenderTimeSet) {
}
TEST_F(VideoCaptureInputTest, TestRtpTimeStampSet) {
input_frames_.push_back(CreateVideoFrame(static_cast<uint8_t>(0)));
input_frames_.push_back(CreateVideoFrame(0));
input_frames_[0]->set_render_time_ms(0);
input_frames_[0]->set_ntp_time_ms(1);
input_frames_[0]->set_timestamp(0);
@ -161,6 +161,32 @@ TEST_F(VideoCaptureInputTest, TestRtpTimeStampSet) {
input_frames_[0]->ntp_time_ms() * 90);
}
TEST_F(VideoCaptureInputTest, DropsFramesWithSameOrOldNtpTimestamp) {
input_frames_.push_back(CreateVideoFrame(0));
input_frames_[0]->set_ntp_time_ms(17);
AddInputFrame(input_frames_[0]);
WaitOutputFrame();
EXPECT_EQ(output_frames_[0]->timestamp(),
input_frames_[0]->ntp_time_ms() * 90);
// Repeat frame with the same NTP timestamp should drop.
AddInputFrame(input_frames_[0]);
EXPECT_EQ(kEventTimeout, output_frame_event_->Wait(FRAME_TIMEOUT_MS));
// As should frames with a decreased NTP timestamp.
input_frames_[0]->set_ntp_time_ms(input_frames_[0]->ntp_time_ms() - 1);
AddInputFrame(input_frames_[0]);
EXPECT_EQ(kEventTimeout, output_frame_event_->Wait(FRAME_TIMEOUT_MS));
// But delivering with an increased NTP timestamp should succeed.
input_frames_[0]->set_ntp_time_ms(4711);
AddInputFrame(input_frames_[0]);
WaitOutputFrame();
EXPECT_EQ(output_frames_[1]->timestamp(),
input_frames_[0]->ntp_time_ms() * 90);
}
TEST_F(VideoCaptureInputTest, TestTextureFrames) {
const int kNumFrame = 3;
for (int i = 0 ; i < kNumFrame; ++i) {