Chromium Code Reviews| 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 5b9a0e9632a413068e687aeb1df7d119fd3306a7..87b7fa4e7b3253a97c751c06f8d76c3b9bdbf948 100644 |
| --- a/media/base/android/media_source_player_unittest.cc |
| +++ b/media/base/android/media_source_player_unittest.cc |
| @@ -1043,7 +1043,9 @@ TEST_F(MediaSourcePlayerTest, SetEmptySurfaceAndStarveWhileDecoding) { |
| // Playback resumes once a non-empty surface is passed. |
| CreateNextTextureAndSetVideoSurface(); |
| - EXPECT_EQ(1, demuxer_->num_browser_seek_requests()); |
| + EXPECT_EQ(0, demuxer_->num_browser_seek_requests()); |
| + while(demuxer_->num_browser_seek_requests() != 1) |
| + message_loop_.RunUntilIdle(); |
| WaitForVideoDecodeDone(); |
| } |
| @@ -1534,6 +1536,33 @@ TEST_F(MediaSourcePlayerTest, BrowserSeek_MidStreamReleaseAndStart) { |
| EXPECT_EQ(1, demuxer_->num_seek_requests()); |
| } |
| +TEST_F(MediaSourcePlayerTest, NoBrowserSeekWithKeyFrameInCache) { |
| + SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |
| + |
| + // Test that browser seek is not needed if a key frame is found in data |
| + // cache. |
| + CreateNextTextureAndSetVideoSurface(); |
| + StartVideoDecoderJob(); |
| + DemuxerData data = CreateReadFromDemuxerAckForVideo(false); |
| + data.access_units[0].is_key_frame = true; |
| + |
| + // Simulate demuxer's response to the video data request. |
| + player_.OnDemuxerDataAvailable(data); |
| + |
| + // Trigger decoder recreation later by changing surfaces. |
| + CreateNextTextureAndSetVideoSurface(); |
| + |
| + // Wait for the media codec bridge to finish decoding and be reset. |
| + WaitForVideoDecodeDone(); |
|
wolenetz
2015/02/04 21:07:23
nit: after waiting here, confirm explicitly that t
qinmin
2015/02/04 23:11:23
Done.
|
| + |
| + // Send a non key frame to decoder so that decoder can continue. This will |
| + // not trigger any browser seeks as the previous key frame is still in the |
| + // buffer. |
| + player_.OnDemuxerDataAvailable(CreateReadFromDemuxerAckForVideo(false)); |
| + WaitForVideoDecodeDone(); |
| + EXPECT_EQ(0, demuxer_->num_browser_seek_requests()); |
| +} |
| + |
| TEST_F(MediaSourcePlayerTest, PrerollAudioAfterSeek) { |
| SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |