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

Unified Diff: media/filters/video_renderer_algorithm_unittest.cc

Issue 1126413002: Handle incoming frames with the same timestamp. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo. Created 5 years, 7 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 | « media/filters/video_renderer_algorithm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_algorithm_unittest.cc
diff --git a/media/filters/video_renderer_algorithm_unittest.cc b/media/filters/video_renderer_algorithm_unittest.cc
index 3fb658a5569a5d4f2cdeebfa1676b42f7b0f38a5..4ea7d53ee25bc23413e88d146c4445d987746485 100644
--- a/media/filters/video_renderer_algorithm_unittest.cc
+++ b/media/filters/video_renderer_algorithm_unittest.cc
@@ -1124,4 +1124,38 @@ TEST_F(VideoRendererAlgorithmTest, UglyTimestampsHaveCadence) {
}
}
+TEST_F(VideoRendererAlgorithmTest, EnqueueFrames) {
+ TickGenerator tg(base::TimeTicks(), 50);
+ time_source_.StartTicking();
+
+ EXPECT_EQ(0u, frames_queued());
+ scoped_refptr<VideoFrame> frame_1 = CreateFrame(tg.interval(0));
+ algorithm_.EnqueueFrame(frame_1);
+ EXPECT_EQ(1u, frames_queued());
+
+ // Enqueuing a frame with the same timestamp should not increase the queue and
+ // just replace the existing frame if we haven't rendered it.
+ scoped_refptr<VideoFrame> frame_2 = CreateFrame(tg.interval(0));
+ algorithm_.EnqueueFrame(frame_2);
+ EXPECT_EQ(1u, frames_queued());
+
+ size_t frames_dropped = 0;
+ scoped_refptr<VideoFrame> rendered_frame =
+ RenderAndStep(&tg, &frames_dropped);
+ EXPECT_EQ(1u, frames_queued());
+ EXPECT_EQ(frame_2, rendered_frame);
+
+ // The replaced frame should count as dropped.
+ EXPECT_EQ(1u, frames_dropped);
+
+ // Trying to replace frame_2 with frame_1 should do nothing.
+ algorithm_.EnqueueFrame(frame_1);
+ EXPECT_EQ(1u, frames_queued());
+
+ rendered_frame = RenderAndStep(&tg, &frames_dropped);
+ EXPECT_EQ(1u, frames_queued());
+ EXPECT_EQ(frame_2, rendered_frame);
+ EXPECT_EQ(1u, frames_dropped);
+}
+
} // namespace media
« no previous file with comments | « media/filters/video_renderer_algorithm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698