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

Unified Diff: media/test/pipeline_integration_test.cc

Issue 806443002: Enable PipelineIntegrationTests in mojo! (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. All pass! Created 6 years 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/test/pipeline_integration_test.cc
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index 279c12221ce254fc8ad78714774e15b3b1bda807..44e165d907f5848bb9cdbc5b89f5f3fc32c577c5 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -10,6 +10,7 @@
#include "media/base/cdm_callback_promise.h"
#include "media/base/cdm_context.h"
#include "media/base/decoder_buffer.h"
+#include "media/base/media.h"
#include "media/base/media_keys.h"
#include "media/base/media_switches.h"
#include "media/base/test_data_util.h"
@@ -20,6 +21,27 @@
#include "media/test/pipeline_integration_test_base.h"
#include "testing/gmock/include/gmock/gmock.h"
+#if defined(MOJO_RENDERER)
+#include "media/mojo/services/mojo_renderer_impl.h"
+#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/application/application_test_base.h"
+#include "mojo/public/cpp/application/connect.h"
+
+// TODO(dalecurtis): The mojo renderer is in another process, so we have no way
+// currently to get hashes for video and audio samples. This also means that
+// real audio plays out for each test.
+#define DISABLE_HASH_CHECKS 1
xhwang 2014/12/17 05:25:03 How about having a EXPECT_HASH or CHECK_HASH macro
DaleCurtis 2014/12/17 21:40:49 This makes sense.
+#define DISABLE_FORMAT_CHECKS 1
xhwang 2014/12/17 05:25:03 ditto
DaleCurtis 2014/12/17 21:40:50 As does this.
+
+// TODO(xhwang): EME support is not complete for the mojo renderer, so all
+// encrypted tests are currently disabled.
+#define DISABLE_EME_TESTS 1
+
+// TODO(xhwang,dalecurtis): Text tracks are not currently supported by the mojo
+// renderer.
+#define DISABLE_TEXT_TRACK_TESTS 1
xhwang 2014/12/17 05:25:03 ditto
DaleCurtis 2014/12/17 21:40:50 This doesn't make sense though, since it's an enti
+#endif
+
using testing::_;
using testing::AnyNumber;
using testing::AtLeast;
@@ -40,9 +62,11 @@ const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\"";
#if defined(USE_PROPRIETARY_CODECS)
const char kADTS[] = "audio/aac";
const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\"";
-const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\"";
const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\"";
+#if !defined(DISABLE_EME_TESTS)
+const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\"";
const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\"";
+#endif // !defined(DISABLE_EME_TESTS)
const char kMP3[] = "audio/mpeg";
#endif // defined(USE_PROPRIETARY_CODECS)
@@ -70,8 +94,10 @@ const int kVP9WebMFileDurationMs = 2736;
const int kVP8AWebMFileDurationMs = 2733;
#if defined(USE_PROPRIETARY_CODECS)
+#if !defined(DISABLE_EME_TESTS)
const int k640IsoFileDurationMs = 2737;
const int k640IsoCencFileDurationMs = 2736;
+#endif // !defined(DISABLE_EME_TESTS)
const int k1280IsoFileDurationMs = 2736;
const int k1280IsoAVC3FileDurationMs = 2736;
#endif // defined(USE_PROPRIETARY_CODECS)
@@ -556,9 +582,41 @@ class MockMediaSource {
base::TimeDelta last_timestamp_offset_;
};
-class PipelineIntegrationTest
- : public testing::Test,
- public PipelineIntegrationTestBase {
+#if defined(MOJO_RENDERER)
+class PipelineIntegrationTestHost : public mojo::test::ApplicationTestBase,
+ public PipelineIntegrationTestBase {
+ public:
+ virtual bool ShouldCreateDefaultRunLoop() override { return false; }
xhwang 2014/12/17 05:25:03 s/virtual//
DaleCurtis 2014/12/17 21:40:50 Done.
+
+ virtual void SetUp() override {
xhwang 2014/12/17 05:25:03 s/virtual//
DaleCurtis 2014/12/17 21:40:50 Done.
+ ApplicationTestBase::SetUp();
+
+ // TODO(dalecurtis): For some reason this isn't done...
+ if (!CommandLine::InitializedForCurrentProcess()) {
+ CommandLine::Init(0, NULL);
+ InitializeMediaLibraryForTesting();
+ }
+ }
+
+ protected:
+ scoped_ptr<Renderer> CreateRenderer() override {
+ mojo::ServiceProvider* service_provider =
+ application_impl()
+ ->ConnectToApplication("mojo://media")
+ ->GetServiceProvider();
+
+ mojo::MediaRendererPtr mojo_media_renderer;
+ mojo::ConnectToService(service_provider, &mojo_media_renderer);
+ return make_scoped_ptr(new MojoRendererImpl(message_loop_.task_runner(),
+ mojo_media_renderer.Pass()));
+ }
+};
+#else
+class PipelineIntegrationTestHost : public testing::Test,
+ public PipelineIntegrationTestBase {};
+#endif
+
+class PipelineIntegrationTest : public PipelineIntegrationTestHost {
public:
void StartPipelineWithMediaSource(MockMediaSource* source) {
EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1));
@@ -686,8 +744,10 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHashed) {
ASSERT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_HASH_CHECKS)
EXPECT_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash());
EXPECT_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash());
+#endif
EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null());
}
@@ -698,8 +758,10 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackLive) {
ASSERT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_HASH_CHECKS)
EXPECT_EQ("f0be120a90a811506777c99a2cdf7cc1", GetVideoHash());
EXPECT_EQ("-3.59,-2.06,-0.43,2.15,0.77,-0.95,", GetAudioHash());
+#endif
// TODO: Fix FFmpeg code to return higher resolution time values so
// we don't have to truncate our expectations here.
@@ -711,10 +773,13 @@ TEST_F(PipelineIntegrationTest, F32PlaybackHashed) {
ASSERT_EQ(PIPELINE_OK, Start("sfx_f32le.wav", kHashed));
Play();
ASSERT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_HASH_CHECKS)
EXPECT_EQ(std::string(kNullVideoHash), GetVideoHash());
EXPECT_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash());
+#endif
}
+#if !defined(DISABLE_EME_TESTS)
TEST_F(PipelineIntegrationTest, BasicPlaybackEncrypted) {
FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
set_encrypted_media_init_data_cb(
@@ -729,6 +794,7 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackEncrypted) {
ASSERT_TRUE(WaitUntilOnEnded());
Stop();
}
+#endif // !defined(DISABLE_EME_TESTS)
TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) {
MockMediaSource source("bear-320x240.webm", kWebM, 219229);
@@ -842,7 +908,9 @@ TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) {
ASSERT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_HASH_CHECKS)
EXPECT_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash());
+#endif
source.Abort();
Stop();
@@ -873,6 +941,7 @@ TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) {
Stop();
}
+#if !defined(DISABLE_EME_TESTS)
TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) {
MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
kAppendWholeFile);
@@ -957,6 +1026,7 @@ TEST_F(PipelineIntegrationTest,
EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
source.Abort();
}
+#endif // !defined(DISABLE_EME_TESTS)
#if defined(USE_PROPRIETARY_CODECS)
TEST_F(PipelineIntegrationTest, MediaSource_ADTS) {
@@ -1002,8 +1072,10 @@ TEST_F(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) {
EXPECT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_HASH_CHECKS)
// Verify preroll is stripped.
EXPECT_EQ("-0.06,0.97,-0.90,-0.70,-0.53,-0.34,", GetAudioHash());
+#endif
}
TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) {
@@ -1013,8 +1085,10 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) {
ASSERT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_HASH_CHECKS)
// Verify codec delay and preroll are stripped.
EXPECT_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash());
+#endif
}
TEST_F(PipelineIntegrationTest, MediaSource_MP3) {
@@ -1030,8 +1104,10 @@ TEST_F(PipelineIntegrationTest, MediaSource_MP3) {
EXPECT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_HASH_CHECKS)
// Verify that codec delay was stripped.
EXPECT_EQ("1.01,2.71,4.18,4.32,3.04,1.12,", GetAudioHash());
+#endif
}
TEST_F(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) {
@@ -1098,6 +1174,7 @@ TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_MP4) {
Stop();
}
+#if !defined(DISABLE_EME_TESTS)
TEST_F(PipelineIntegrationTest,
MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly) {
MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
@@ -1211,6 +1288,7 @@ TEST_F(PipelineIntegrationTest,
EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
source.Abort();
}
+#endif // !defined(DISABLE_EME_TESTS)
// Verify files which change configuration midstream fail gracefully.
TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) {
@@ -1227,6 +1305,7 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) {
ASSERT_TRUE(WaitUntilOnEnded());
}
+#if !defined(DISABLE_EME_TESTS)
TEST_F(PipelineIntegrationTest, EncryptedPlayback_WebM) {
MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816);
FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
@@ -1273,8 +1352,10 @@ TEST_F(PipelineIntegrationTest, EncryptedPlayback_NoEncryptedFrames_WebM) {
source.Abort();
Stop();
}
+#endif // !defined(DISABLE_EME_TESTS)
#if defined(USE_PROPRIETARY_CODECS)
+#if !defined(DISABLE_EME_TESTS)
TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_VideoOnly) {
MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video,
kAppendWholeFile);
@@ -1341,24 +1422,6 @@ TEST_F(PipelineIntegrationTest,
Stop();
}
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) {
- MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3,
- kAppendWholeFile);
- StartPipelineWithMediaSource(&source);
- source.EndOfStream();
-
- EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
- EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
- EXPECT_EQ(k1280IsoAVC3FileDurationMs,
- pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
-
- Play();
-
- ASSERT_TRUE(WaitUntilOnEnded());
- source.Abort();
- Stop();
-}
-
TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Video) {
MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4",
kMP4Video, kAppendWholeFile);
@@ -1390,7 +1453,26 @@ TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Audio) {
source.Abort();
Stop();
}
-#endif
+#endif // !defined(DISABLE_EME_TESTS)
+
+TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) {
+ MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3,
+ kAppendWholeFile);
+ StartPipelineWithMediaSource(&source);
+ source.EndOfStream();
+
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
+ EXPECT_EQ(k1280IsoAVC3FileDurationMs,
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
+
+ Play();
+
+ ASSERT_TRUE(WaitUntilOnEnded());
+ source.Abort();
+ Stop();
+}
+#endif // defined(USE_PROPRIETARY_CODECS)
TEST_F(PipelineIntegrationTest, SeekWhilePaused) {
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
@@ -1459,7 +1541,7 @@ TEST_F(PipelineIntegrationTest, Rotated_Metadata_270) {
// Verify audio decoder & renderer can handle aborted demuxer reads.
TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) {
ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM,
- 8192,
+ 16384,
base::TimeDelta::FromMilliseconds(464),
base::TimeDelta::FromMilliseconds(617),
0x10CA, 19730));
@@ -1501,7 +1583,10 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) {
ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a.webm"));
Play();
ASSERT_TRUE(WaitUntilOnEnded());
+
+#if !defined(DISABLE_FORMAT_CHECKS)
EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A);
+#endif
}
// Verify that VP8A video with odd width/height can be played back.
@@ -1509,7 +1594,9 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_Odd_WebM) {
ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a-odd-dimensions.webm"));
Play();
ASSERT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_FORMAT_CHECKS)
EXPECT_EQ(last_video_frame_format_, VideoFrame::YV12A);
+#endif
}
// Verify that VP9 video with odd width/height can be played back.
@@ -1519,6 +1606,7 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) {
ASSERT_TRUE(WaitUntilOnEnded());
}
+#if !defined(DISABLE_TEXT_TRACK_TESTS)
// Verify that VP8 video with inband text track can be played back.
TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) {
EXPECT_CALL(*this, OnAddTextTrack(_, _));
@@ -1526,13 +1614,16 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) {
Play();
ASSERT_TRUE(WaitUntilOnEnded());
}
+#endif // !defined(DISABLE_TEXT_TRACK_TESTS)
// Verify that VP9 video with 4:4:4 subsampling can be played back.
TEST_F(PipelineIntegrationTest, P444_VP9_WebM) {
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-P444.webm"));
Play();
ASSERT_TRUE(WaitUntilOnEnded());
+#if !defined(DISABLE_FORMAT_CHECKS)
EXPECT_EQ(last_video_frame_format_, VideoFrame::YV24);
+#endif
}
// Verify that videos with an odd frame size playback successfully.

Powered by Google App Engine
This is Rietveld 408576698