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

Unified Diff: media/filters/video_renderer_impl_unittest.cc

Issue 391023002: Add playback underflow logic to media::VideoRendererImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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_impl.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_impl_unittest.cc
diff --git a/media/filters/video_renderer_impl_unittest.cc b/media/filters/video_renderer_impl_unittest.cc
index efa45fb1ab52686104ea8efadb10a7d5d3d72982..56898926cc63092c376fb05694f0e5cbcd9237bc 100644
--- a/media/filters/video_renderer_impl_unittest.cc
+++ b/media/filters/video_renderer_impl_unittest.cc
@@ -421,7 +421,7 @@ TEST_F(VideoRendererImplTest, FlushWithNothingBuffered) {
TEST_F(VideoRendererImplTest, EndOfStream_ClipDuration) {
Initialize();
- QueueFrames("0 10 20 30");
+ QueueFrames("0");
EXPECT_CALL(mock_cb_, Display(HasTimestamp(0)));
EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH));
StartPlayingFrom(0);
@@ -497,8 +497,12 @@ TEST_F(VideoRendererImplTest, StartPlayingFrom_LowDelay) {
InitializeWithLowDelay(true);
QueueFrames("0");
+ // Expect to frequently have enough/nothing due to only requiring one frame.
EXPECT_CALL(mock_cb_, Display(HasTimestamp(0)));
- EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH));
+ EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH))
+ .Times(AtLeast(1));
+ EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING))
+ .Times(AtLeast(1));
StartPlayingFrom(0);
QueueFrames("10");
@@ -547,4 +551,35 @@ TEST_F(VideoRendererImplTest, VideoDecoder_InitFailure) {
Stop();
}
+TEST_F(VideoRendererImplTest, Underflow) {
+ Initialize();
+ QueueFrames("0 10 20 30");
+ EXPECT_CALL(mock_cb_, Display(HasTimestamp(0)));
+ EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH));
+ StartPlayingFrom(0);
+
+ // Frames should be dropped and we should signal having nothing.
+ {
+ SCOPED_TRACE("Waiting for BUFFERING_HAVE_NOTHING");
+ WaitableMessageLoopEvent event;
+ EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_NOTHING))
+ .WillOnce(RunClosure(event.GetClosure()));
+ AdvanceTimeInMs(100);
+ event.RunAndWait();
+ }
+
+ // Receiving end of stream should signal having enough.
+ {
+ SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH");
+ WaitableMessageLoopEvent event;
+ EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH))
+ .WillOnce(RunClosure(event.GetClosure()));
+ SatisfyPendingReadWithEndOfStream();
+ event.RunAndWait();
+ }
+
+ WaitForEnded();
+ Shutdown();
+}
+
} // namespace media
« no previous file with comments | « media/filters/video_renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698