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..79455feaa6b8bb8144243f4717528970ba802d76 100644 |
--- a/media/base/android/media_source_player_unittest.cc |
+++ b/media/base/android/media_source_player_unittest.cc |
@@ -886,6 +886,38 @@ TEST_F(MediaSourcePlayerTest, ChangeMultipleSurfaceWhileDecoding) { |
EXPECT_EQ(1, demuxer_->num_seek_requests()); |
} |
+TEST_F(MediaSourcePlayerTest, SetEmptySurfaceAndStarveWhileDecoding) { |
+ SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |
+ |
+ // Test player pauses if an empty surface is passed. |
+ CreateNextTextureAndSetVideoSurface(); |
+ StartVideoDecoderJob(true); |
+ EXPECT_EQ(1, demuxer_->num_data_requests()); |
+ |
+ // 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()); |
+ |
+ // Let the player starve. However, it should not issue any new data request in |
+ // this case. |
+ TriggerPlayerStarvation(); |
+ // Wait for the decoder job to finish decoding and be reset. |
+ while (GetMediaDecoderJob(false)) |
+ message_loop_.RunUntilIdle(); |
+ |
+ // No further seek or data requests should have been received since the |
+ // surface is empty. |
+ EXPECT_EQ(0, demuxer_->num_browser_seek_requests()); |
+ EXPECT_EQ(1, demuxer_->num_data_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(); |