Index: media/base/android/media_source_player_unittest.cc |
diff --git a/media/base/android/media_source_player_unittest.cc b/media/base/android/media_source_player_unittest.cc |
index c07210be432eda55c6b2edcf118daeae1dcbb8ef..9983628f147e3fce35637b125226bd34a9c70369 100644 |
--- a/media/base/android/media_source_player_unittest.cc |
+++ b/media/base/android/media_source_player_unittest.cc |
@@ -886,6 +886,32 @@ TEST_F(MediaSourcePlayerTest, ChangeMultipleSurfaceWhileDecoding) { |
EXPECT_EQ(1, demuxer_->num_seek_requests()); |
} |
+TEST_F(MediaSourcePlayerTest, SetEmptySurfaceWhileDecoding) { |
+ SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |
+ |
+ // Test player pauses if an empty surface is passed. |
+ CreateNextTextureAndSetVideoSurface(); |
+ StartVideoDecoderJob(true); |
+ |
+ // Send the first input chunk. |
+ player_.OnDemuxerDataAvailable(CreateReadFromDemuxerAckForVideo()); |
+ |
+ // While the decoder is decoding, pass an empty surface. |
+ gfx::ScopedJavaSurface empty_surface; |
+ player_.SetVideoSurface(empty_surface.Pass()); |
wolenetz
2014/02/20 20:52:11
Is this where the NPE previously occurred prior to
qinmin
2014/02/20 22:36:05
Added a TriggerPlayerStarvation() call to let the
|
+ |
+ // Wait for the decoder job to finish decoding and be reset. |
+ while (GetMediaDecoderJob(false)) |
+ message_loop_.RunUntilIdle(); |
+ |
+ // No seek request should have been received since the surface is empty. |
+ EXPECT_EQ(0, demuxer_->num_browser_seek_requests()); |
+ |
+ // Playback resumes once a non-empty surface is passed. |
+ CreateNextTextureAndSetVideoSurface(); |
+ EXPECT_EQ(1, demuxer_->num_browser_seek_requests()); |
+} |
+ |
TEST_F(MediaSourcePlayerTest, AudioOnlyStartAfterSeekFinish) { |
SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |