Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Unified Diff: webrtc/video/video_capture_input_unittest.cc

Issue 1220193002: Add test for dropping repeated NTP timestamps. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_capture_input_unittest.cc
diff --git a/webrtc/video/video_capture_input_unittest.cc b/webrtc/video/video_capture_input_unittest.cc
index cc4b5b08d227e4b5b54b480713d04097b3b7af2e..2ab7e51dc4599f9a5daadd4e7644f290f3f59ec3 100644
--- a/webrtc/video/video_capture_input_unittest.cc
+++ b/webrtc/video/video_capture_input_unittest.cc
@@ -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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698