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

Unified Diff: media/renderers/video_renderer_impl_unittest.cc

Issue 2371833005: Merge M54: "Transition to have nothing if background rendering evicts all frames." (Closed)
Patch Set: Created 4 years, 3 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/renderers/video_renderer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/video_renderer_impl_unittest.cc
diff --git a/media/renderers/video_renderer_impl_unittest.cc b/media/renderers/video_renderer_impl_unittest.cc
index 55a4a4fb9cd17d6df60a80e57059cf5c400586cc..ef59624632dcc7ff6360a785a75d1ae887a3f1c4 100644
--- a/media/renderers/video_renderer_impl_unittest.cc
+++ b/media/renderers/video_renderer_impl_unittest.cc
@@ -913,6 +913,53 @@ TEST_F(VideoRendererImplTest, UnderflowEvictionBeforeEOS) {
Destroy();
}
+// Tests the case where underflow evicts all frames in the HAVE_ENOUGH state.
+TEST_F(VideoRendererImplTest, UnderflowEvictionWhileHaveEnough) {
+ Initialize();
+ QueueFrames("0 30 60 90 100");
+
+ {
+ SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH");
+ WaitableMessageLoopEvent event;
+ EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH))
+ .WillOnce(RunClosure(event.GetClosure()));
+ EXPECT_CALL(mock_cb_, FrameReceived(_)).Times(AnyNumber());
+ EXPECT_CALL(mock_cb_, OnVideoNaturalSizeChange(_)).Times(1);
+ EXPECT_CALL(mock_cb_, OnVideoOpacityChange(_)).Times(1);
+ EXPECT_CALL(mock_cb_, OnStatisticsUpdate(_)).Times(AnyNumber());
+ StartPlayingFrom(0);
+ event.RunAndWait();
+ }
+
+ null_video_sink_->set_background_render(true);
+ time_source_.StartTicking();
+ renderer_->OnTimeStateChanged(true);
+ WaitForPendingDecode();
+ renderer_->OnTimeStateChanged(false);
+
+ // Jump time far enough forward that no frames are valid.
+ AdvanceTimeInMs(1000);
+
+ {
+ SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING");
+ WaitableMessageLoopEvent event;
+ EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_NOTHING))
+ .WillOnce(RunClosure(event.GetClosure()));
+ QueueFrames("120");
+ SatisfyPendingDecode();
+ event.RunAndWait();
+ }
+
+ // This should do nothing.
+ renderer_->OnTimeStateChanged(true);
+
+ // Providing the end of stream packet should remove all frames and exit.
+ SatisfyPendingDecodeWithEndOfStream();
+ EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH));
+ WaitForEnded();
+ Destroy();
+}
+
TEST_F(VideoRendererImplTest, StartPlayingFromThenFlushThenEOS) {
Initialize();
QueueFrames("0 30 60 90");
« no previous file with comments | « media/renderers/video_renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698