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

Unified Diff: media/base/android/media_codec_decoder_unittest.cc

Issue 1254293003: MediaCodecPlayer implementation (stage 4 - preroll) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-browserseek
Patch Set: Added unit test for video-only preroll Created 5 years, 4 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
Index: media/base/android/media_codec_decoder_unittest.cc
diff --git a/media/base/android/media_codec_decoder_unittest.cc b/media/base/android/media_codec_decoder_unittest.cc
index d32c8aea182f73102333eb43383a744baf07c909..2c6808d6b0eef65fd82a732712e0befee0733314 100644
--- a/media/base/android/media_codec_decoder_unittest.cc
+++ b/media/base/android/media_codec_decoder_unittest.cc
@@ -149,6 +149,7 @@ class MediaCodecDecoderTest : public testing::Test {
// Decoder callbacks.
void OnDataRequested();
void OnStarvation() { is_starved_ = true; }
+ void OnPrerollDone() { decoder_->ResumeAfterPreroll(); }
void OnStopDone() { is_stopped_ = true; }
void OnError() {}
void OnUpdateCurrentTime(base::TimeDelta now_playing,
@@ -231,6 +232,7 @@ void MediaCodecDecoderTest::CreateAudioDecoder() {
task_runner_, base::Bind(&MediaCodecDecoderTest::OnDataRequested,
base::Unretained(this)),
base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)),
+ base::Bind(&MediaCodecDecoderTest::OnPrerollDone, base::Unretained(this)),
base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)),
base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)),
base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime,
@@ -245,6 +247,7 @@ void MediaCodecDecoderTest::CreateVideoDecoder() {
task_runner_, base::Bind(&MediaCodecDecoderTest::OnDataRequested,
base::Unretained(this)),
base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)),
+ base::Bind(&MediaCodecDecoderTest::OnPrerollDone, base::Unretained(this)),
base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)),
base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)),
base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime,
@@ -490,7 +493,10 @@ TEST_F(MediaCodecDecoderTest, AudioPlayTillCompletion) {
EXPECT_TRUE(decoder_->IsCompleted());
// Last buffered timestamp should be no less than PTS.
- EXPECT_EQ(22, pts_stat_.num_values());
+ // The number of hits in pts_stat_ depends on the preroll implementation.
+ // We might not report the time for the first buffer after preroll that
+ // is written to the audio track. pts_stat_.num_values() is either 21 or 22.
+ EXPECT_LE(21, pts_stat_.num_values());
EXPECT_LE(data_factory_->last_pts(), pts_stat_.max());
}

Powered by Google App Engine
This is Rietveld 408576698