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

Unified Diff: media/filters/video_renderer_algorithm_unittest.cc

Issue 2502093002: Adjust VideoRendererAlgorithm for |frame_dropping_disabled_| (Closed)
Patch Set: Style fixes, new unit test Created 4 years, 1 month 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 d8562eec8bfcd4bd1c80cd9a146be2eb63370e14..77ea231db8a84e5248182fa8b8712606c77abff9 100644
--- a/media/filters/video_renderer_algorithm_unittest.cc
+++ b/media/filters/video_renderer_algorithm_unittest.cc
@@ -718,6 +718,38 @@ TEST_F(VideoRendererAlgorithmTest, EffectiveFramesQueuedWithoutCadence) {
EXPECT_EQ(96, algorithm_.GetMemoryUsage());
}
+TEST_F(VideoRendererAlgorithmTest, EffectiveFramesQueuedWithoutFrameDropping) {
+ TickGenerator tg(tick_clock_->NowTicks(), 50);
+
+ algorithm_.disable_frame_dropping();
+
+ ASSERT_EQ(0u, EffectiveFramesQueued());
+ time_source_.StartTicking();
+
+ for (size_t i = 0; i < 3; ++i) {
+ algorithm_.EnqueueFrame(CreateFrame(tg.interval(i)));
+ EXPECT_EQ(i + 1, EffectiveFramesQueued());
+ EXPECT_EQ(i + 1, frames_queued());
+ }
+
+ // Issue a render call and verify that undropped frames remain effective.
+ tg.step(2);
+ size_t frames_dropped = 0;
+ scoped_refptr<VideoFrame> frame = RenderAndStep(&tg, &frames_dropped);
+ ASSERT_NE(nullptr, frame);
+ EXPECT_EQ(tg.interval(0), frame->timestamp());
+ EXPECT_EQ(0u, frames_dropped);
+ EXPECT_EQ(2u, EffectiveFramesQueued());
+
+ // As the next frame is consumed, the count of effective frames is
+ // decremented.
+ frame = RenderAndStep(&tg, &frames_dropped);
+ ASSERT_NE(nullptr, frame);
+ EXPECT_EQ(tg.interval(1), frame->timestamp());
+ EXPECT_EQ(0u, frames_dropped);
+ EXPECT_EQ(1u, EffectiveFramesQueued());
+}
+
// The maximum acceptable drift should be updated once we have two frames.
TEST_F(VideoRendererAlgorithmTest, AcceptableDriftUpdated) {
TickGenerator tg(tick_clock_->NowTicks(), 50);
« 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