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

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

Issue 1242913004: MediaCodecPlayer implementation (stage 3 - browser seek and surface change) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-seek
Patch Set: Rebased, changed DCHECKs. Created 5 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/base/android/media_codec_decoder.cc ('k') | media/base/android/media_codec_player.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39e6661f9373836fd0e454908f483038fda225a1..d32c8aea182f73102333eb43383a744baf07c909 100644
--- a/media/base/android/media_codec_decoder_unittest.cc
+++ b/media/base/android/media_codec_decoder_unittest.cc
@@ -277,7 +277,7 @@ void MediaCodecDecoderTest::SetVideoSurface() {
ASSERT_NE(nullptr, decoder_.get());
MediaCodecVideoDecoder* video_decoder =
static_cast<MediaCodecVideoDecoder*>(decoder_.get());
- video_decoder->SetPendingSurface(surface.Pass());
+ video_decoder->SetVideoSurface(surface.Pass());
}
TEST_F(MediaCodecDecoderTest, AudioPrefetch) {
@@ -312,7 +312,7 @@ TEST_F(MediaCodecDecoderTest, AudioConfigureNoParams) {
CreateAudioDecoder();
// Cannot configure without config parameters.
- EXPECT_EQ(MediaCodecDecoder::CONFIG_FAILURE, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigFailure, decoder_->Configure());
}
TEST_F(MediaCodecDecoderTest, AudioConfigureValidParams) {
@@ -324,7 +324,7 @@ TEST_F(MediaCodecDecoderTest, AudioConfigureValidParams) {
scoped_ptr<AudioFactory> factory(new AudioFactory(duration));
decoder_->SetDemuxerConfigs(factory->GetConfigs());
- EXPECT_EQ(MediaCodecDecoder::CONFIG_OK, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigOk, decoder_->Configure());
}
TEST_F(MediaCodecDecoderTest, VideoConfigureNoParams) {
@@ -332,8 +332,22 @@ TEST_F(MediaCodecDecoderTest, VideoConfigureNoParams) {
CreateVideoDecoder();
+ // decoder_->Configure() searches back for the key frame.
+ // We have to prefetch decoder.
+
+ base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
+ SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+
+ decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
+ base::Unretained(this), true));
+
+ EXPECT_TRUE(WaitForCondition(base::Bind(&MediaCodecDecoderTest::is_prefetched,
+ base::Unretained(this))));
+
+ SetVideoSurface();
+
// Cannot configure without config parameters.
- EXPECT_EQ(MediaCodecDecoder::CONFIG_FAILURE, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigFailure, decoder_->Configure());
}
TEST_F(MediaCodecDecoderTest, VideoConfigureNoSurface) {
@@ -357,7 +371,7 @@ TEST_F(MediaCodecDecoderTest, VideoConfigureNoSurface) {
// Surface is not set, Configure() should fail.
- EXPECT_EQ(MediaCodecDecoder::CONFIG_FAILURE, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigFailure, decoder_->Configure());
}
TEST_F(MediaCodecDecoderTest, VideoConfigureInvalidSurface) {
@@ -389,9 +403,9 @@ TEST_F(MediaCodecDecoderTest, VideoConfigureInvalidSurface) {
MediaCodecVideoDecoder* video_decoder =
static_cast<MediaCodecVideoDecoder*>(decoder_.get());
- video_decoder->SetPendingSurface(surface.Pass());
+ video_decoder->SetVideoSurface(surface.Pass());
- EXPECT_EQ(MediaCodecDecoder::CONFIG_FAILURE, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigFailure, decoder_->Configure());
}
TEST_F(MediaCodecDecoderTest, VideoConfigureValidParams) {
@@ -417,7 +431,7 @@ TEST_F(MediaCodecDecoderTest, VideoConfigureValidParams) {
// Now we can expect Configure() to succeed.
- EXPECT_EQ(MediaCodecDecoder::CONFIG_OK, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigOk, decoder_->Configure());
}
TEST_F(MediaCodecDecoderTest, AudioStartWithoutConfigure) {
@@ -464,7 +478,7 @@ TEST_F(MediaCodecDecoderTest, AudioPlayTillCompletion) {
decoder_->SetDemuxerConfigs(GetConfigs());
- EXPECT_EQ(MediaCodecDecoder::CONFIG_OK, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigOk, decoder_->Configure());
EXPECT_TRUE(decoder_->Start(base::TimeDelta::FromMilliseconds(0)));
@@ -503,7 +517,7 @@ TEST_F(MediaCodecDecoderTest, VideoPlayTillCompletion) {
SetVideoSurface();
- EXPECT_EQ(MediaCodecDecoder::CONFIG_OK, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigOk, decoder_->Configure());
EXPECT_TRUE(decoder_->Start(base::TimeDelta::FromMilliseconds(0)));
@@ -540,7 +554,7 @@ TEST_F(MediaCodecDecoderTest, VideoStopAndResume) {
SetVideoSurface();
- EXPECT_EQ(MediaCodecDecoder::CONFIG_OK, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigOk, decoder_->Configure());
SetStopRequestAtTime(stop_request_time);
@@ -608,7 +622,7 @@ TEST_F(MediaCodecDecoderTest, AudioStarvationAndStop) {
// Configure.
decoder_->SetDemuxerConfigs(GetConfigs());
- EXPECT_EQ(MediaCodecDecoder::CONFIG_OK, decoder_->Configure());
+ EXPECT_EQ(MediaCodecDecoder::kConfigOk, decoder_->Configure());
// Start.
EXPECT_TRUE(decoder_->Start(base::TimeDelta::FromMilliseconds(0)));
« no previous file with comments | « media/base/android/media_codec_decoder.cc ('k') | media/base/android/media_codec_player.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698