Index: media/test/pipeline_integration_test.cc |
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc |
index 8d103107a0cc54b5c59ee3b03f589f45ad4532c8..06d4bc4c4ae35b919d337fa66027e79b88f8969b 100644 |
--- a/media/test/pipeline_integration_test.cc |
+++ b/media/test/pipeline_integration_test.cc |
@@ -63,6 +63,9 @@ |
// mojo, so the tests take too long to run. |
#define DISABLE_CLOCKLESS_TESTS 1 |
#else |
+#if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
miu
2017/03/29 01:39:15
Why is this dependent on !defined(MOJO_RENDERER)?
xjz
2017/03/30 23:21:31
Done. It should be ok to remove !defined(MOJO_REND
|
+#include "media/remoting/end2end_test_renderer.h" // nogncheck |
+#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) |
#define EXPECT_HASH_EQ(a, b) EXPECT_EQ(a, b) |
#define EXPECT_VIDEO_FORMAT_EQ(a, b) EXPECT_EQ(a, b) |
#define EXPECT_COLOR_SPACE_EQ(a, b) EXPECT_EQ(a, b) |
@@ -80,12 +83,6 @@ |
#define MAYBE_TEXT(test) test |
#endif |
-#if defined(DISABLE_CLOCKLESS_TESTS) |
-#define MAYBE_CLOCKLESS(test) DISABLED_##test |
-#else |
-#define MAYBE_CLOCKLESS(test) test |
-#endif |
- |
using testing::_; |
using testing::AnyNumber; |
using testing::AtLeast; |
@@ -94,6 +91,8 @@ using testing::SaveArg; |
namespace media { |
+namespace { |
+ |
const char kSourceId[] = "SourceId"; |
const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; |
@@ -666,6 +665,37 @@ class FailingVideoDecoder : public VideoDecoder { |
bool NeedsBitstreamConversion() const override { return true; } |
}; |
+#if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
miu
2017/03/29 01:39:15
Along the lines of my earlier comment, can we just
xjz
2017/03/30 23:21:31
Done. Now removed this class to base.
|
+class RemotingTestRendererFactory final : public PipelineTestRendererFactory { |
+ public: |
+ explicit RemotingTestRendererFactory( |
+ std::unique_ptr<PipelineTestRendererFactory> renderer_factory) |
+ : default_renderer_factory_(std::move(renderer_factory)) {} |
+ ~RemotingTestRendererFactory() override {} |
+ |
+ // PipelineTestRendererFactory implementation. |
+ std::unique_ptr<Renderer> CreateRenderer( |
+ ScopedVector<VideoDecoder> prepend_video_decoders = |
+ ScopedVector<VideoDecoder>(), |
+ ScopedVector<AudioDecoder> prepend_audio_decoders = |
+ ScopedVector<AudioDecoder>()) override { |
+ std::unique_ptr<Renderer> renderer_impl = |
+ default_renderer_factory_->CreateRenderer( |
+ std::move(prepend_video_decoders), |
+ std::move(prepend_audio_decoders)); |
+ return base::MakeUnique<remoting::End2EndTestRenderer>( |
+ std::move(renderer_impl)); |
+ } |
+ |
+ private: |
+ std::unique_ptr<PipelineTestRendererFactory> default_renderer_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(RemotingTestRendererFactory); |
+}; |
+#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+ |
+} // namespace |
+ |
// TODO(xhwang): These tests have been disabled for some time as apptests and no |
// longer pass. They need to be reconstituted as shell tests. |
// Currently there are compile issues which must be resolved, |
@@ -757,7 +787,7 @@ class PipelineIntegrationTest : public PipelineIntegrationTestHost { |
EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); |
} |
- pipeline_->Start(demuxer_.get(), CreateRenderer(), this, |
+ pipeline_->Start(demuxer_.get(), renderer_factory_->CreateRenderer(), this, |
base::Bind(&PipelineIntegrationTest::OnStatusCallback, |
base::Unretained(this))); |
@@ -801,13 +831,20 @@ class PipelineIntegrationTest : public PipelineIntegrationTestHost { |
} |
}; |
+enum PipelineType { |
+ Media, // Test the general media pipeline. |
+ MediaRemoting, // Test Media Remoting pipeline. |
+}; |
+ |
struct PlaybackTestData { |
+ const PipelineType type; |
const std::string filename; |
const uint32_t start_time_ms; |
const uint32_t duration_ms; |
}; |
struct MSEPlaybackTestData { |
+ const PipelineType type; |
const std::string filename; |
const std::string mimetype; |
const size_t append_bytes; |
@@ -834,6 +871,15 @@ class BasicMSEPlaybackTest |
TEST_P(BasicPlaybackTest, PlayToEnd) { |
PlaybackTestData data = GetParam(); |
+#if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
miu
2017/03/29 01:39:14
Instead of duplicating this code for each test fix
xjz
2017/03/30 23:21:31
Done.
|
+ if (data.type == PipelineType::MediaRemoting) { |
+ std::unique_ptr<PipelineTestRendererFactory> factory = |
+ std::move(renderer_factory_); |
+ renderer_factory_.reset( |
+ new RemotingTestRendererFactory(std::move(factory))); |
+ } |
+#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+ |
ASSERT_EQ(PIPELINE_OK, |
Start(data.filename, kClockless | kUnreliableDuration)); |
EXPECT_EQ(data.start_time_ms, demuxer_->GetStartTime().InMilliseconds()); |
@@ -846,6 +892,15 @@ TEST_P(BasicPlaybackTest, PlayToEnd) { |
TEST_P(BasicMSEPlaybackTest, PlayToEnd) { |
MSEPlaybackTestData data = GetParam(); |
+#if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+ if (data.type == PipelineType::MediaRemoting) { |
+ std::unique_ptr<PipelineTestRendererFactory> factory = |
+ std::move(renderer_factory_); |
+ renderer_factory_.reset( |
+ new RemotingTestRendererFactory(std::move(factory))); |
+ } |
+#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+ |
MockMediaSource source(data.filename, data.mimetype, data.append_bytes); |
// TODO -- ADD uint8_t test_type to StartWithMSE and pass clockless flags |
ASSERT_EQ(PIPELINE_OK, |
@@ -869,10 +924,10 @@ TEST_P(BasicMSEPlaybackTest, PlayToEnd) { |
#if BUILDFLAG(USE_PROPRIETARY_CODECS) |
const PlaybackTestData kADTSTests[] = { |
- {"bear-audio-main-aac.aac", 0, 2724}, |
- {"bear-audio-lc-aac.aac", 0, 2858}, |
- {"bear-audio-implicit-he-aac-v1.aac", 0, 2812}, |
- {"bear-audio-implicit-he-aac-v2.aac", 0, 3047}, |
+ {PipelineType::Media, "bear-audio-main-aac.aac", 0, 2724}, |
+ {PipelineType::Media, "bear-audio-lc-aac.aac", 0, 2858}, |
+ {PipelineType::Media, "bear-audio-implicit-he-aac-v1.aac", 0, 2812}, |
+ {PipelineType::Media, "bear-audio-implicit-he-aac-v2.aac", 0, 3047}, |
}; |
// TODO(chcunningham): Migrate other basic playback tests to TEST_P. |
@@ -880,11 +935,28 @@ INSTANTIATE_TEST_CASE_P(ProprietaryCodecs, |
BasicPlaybackTest, |
testing::ValuesIn(kADTSTests)); |
+#if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+const PlaybackTestData kADTSRemotingTests[] = { |
miu
2017/03/29 01:39:15
Let's just have one definition with the remoting e
xjz
2017/03/30 23:21:31
Done.
|
+ {PipelineType::MediaRemoting, "bear-audio-main-aac.aac", 0, 2724}, |
+ {PipelineType::MediaRemoting, "bear-audio-lc-aac.aac", 0, 2858}, |
+ {PipelineType::MediaRemoting, "bear-audio-implicit-he-aac-v1.aac", 0, 2812}, |
+ {PipelineType::MediaRemoting, "bear-audio-implicit-he-aac-v2.aac", 0, 3047}, |
+}; |
+ |
+INSTANTIATE_TEST_CASE_P(ProprietaryCodecs_Remoting, |
+ BasicPlaybackTest, |
+ testing::ValuesIn(kADTSRemotingTests)); |
+#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+ |
const MSEPlaybackTestData kMediaSourceADTSTests[] = { |
- {"bear-audio-main-aac.aac", kADTS, kAppendWholeFile, 2773}, |
- {"bear-audio-lc-aac.aac", kADTS, kAppendWholeFile, 2794}, |
- {"bear-audio-implicit-he-aac-v1.aac", kADTS, kAppendWholeFile, 2858}, |
- {"bear-audio-implicit-he-aac-v2.aac", kADTS, kAppendWholeFile, 2901}, |
+ {PipelineType::Media, "bear-audio-main-aac.aac", kADTS, kAppendWholeFile, |
+ 2773}, |
+ {PipelineType::Media, "bear-audio-lc-aac.aac", kADTS, kAppendWholeFile, |
+ 2794}, |
+ {PipelineType::Media, "bear-audio-implicit-he-aac-v1.aac", kADTS, |
+ kAppendWholeFile, 2858}, |
+ {PipelineType::Media, "bear-audio-implicit-he-aac-v2.aac", kADTS, |
+ kAppendWholeFile, 2901}, |
}; |
// TODO(chcunningham): Migrate other basic MSE playback tests to TEST_P. |
@@ -892,9 +964,53 @@ INSTANTIATE_TEST_CASE_P(ProprietaryCodecs, |
BasicMSEPlaybackTest, |
testing::ValuesIn(kMediaSourceADTSTests)); |
+#if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+const MSEPlaybackTestData kMediaSourceADTSRemotingTests[] = { |
miu
2017/03/29 01:39:15
ditto: Merge into one parameter array.
xjz
2017/03/30 23:21:31
Done.
|
+ {PipelineType::MediaRemoting, "bear-audio-main-aac.aac", kADTS, |
+ kAppendWholeFile, 2773}, |
+ {PipelineType::MediaRemoting, "bear-audio-lc-aac.aac", kADTS, |
+ kAppendWholeFile, 2794}, |
+ {PipelineType::MediaRemoting, "bear-audio-implicit-he-aac-v1.aac", kADTS, |
+ kAppendWholeFile, 2858}, |
+ {PipelineType::MediaRemoting, "bear-audio-implicit-he-aac-v2.aac", kADTS, |
+ kAppendWholeFile, 2901}, |
+}; |
+ |
+INSTANTIATE_TEST_CASE_P(ProprietaryCodecs_Remoting, |
+ BasicMSEPlaybackTest, |
+ testing::ValuesIn(kMediaSourceADTSRemotingTests)); |
+#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+ |
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
-TEST_F(PipelineIntegrationTest, BasicPlayback) { |
+struct IntegrationTestData { |
+ const PipelineType type; |
+}; |
+ |
+// Tells gtest how to print our PlaybackTestData structure. |
+std::ostream& operator<<(std::ostream& os, const IntegrationTestData& data) { |
+ return os << (data.type == PipelineType::Media ? "Media" : "MediaRemoting"); |
+} |
+ |
+// These tests are used to test both media pipeline and media remoting pipeline. |
+class CommonPipelineIntegrationTest |
+ : public PipelineIntegrationTest, |
+ public testing::WithParamInterface<IntegrationTestData> { |
+ public: |
+ CommonPipelineIntegrationTest() { |
+#if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+ IntegrationTestData data = GetParam(); |
+ if (data.type == PipelineType::MediaRemoting) { |
+ std::unique_ptr<PipelineTestRendererFactory> factory = |
+ std::move(renderer_factory_); |
+ renderer_factory_.reset( |
+ new RemotingTestRendererFactory(std::move(factory))); |
+ } |
+#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+ } |
+}; |
+ |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
Play(); |
@@ -902,7 +1018,7 @@ TEST_F(PipelineIntegrationTest, BasicPlayback) { |
ASSERT_TRUE(WaitUntilOnEnded()); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlaybackOpusOgg) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackOpusOgg) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-opus.ogg")); |
Play(); |
@@ -910,7 +1026,7 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackOpusOgg) { |
ASSERT_TRUE(WaitUntilOnEnded()); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlaybackHashed) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHashed) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); |
Play(); |
@@ -926,7 +1042,8 @@ base::TimeDelta TimestampMs(int milliseconds) { |
return base::TimeDelta::FromMilliseconds(milliseconds); |
} |
-TEST_F(PipelineIntegrationTest, PlaybackWithAudioTrackDisabledThenEnabled) { |
+TEST_P(CommonPipelineIntegrationTest, |
+ PlaybackWithAudioTrackDisabledThenEnabled) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); |
// Disable audio. |
@@ -960,7 +1077,8 @@ TEST_F(PipelineIntegrationTest, PlaybackWithAudioTrackDisabledThenEnabled) { |
EXPECT_HASH_EQ("-1.53,0.21,1.23,1.56,-0.34,-0.94,", GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, PlaybackWithVideoTrackDisabledThenEnabled) { |
+TEST_P(CommonPipelineIntegrationTest, |
+ PlaybackWithVideoTrackDisabledThenEnabled) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); |
// Disable video. |
@@ -1003,13 +1121,13 @@ TEST_F(PipelineIntegrationTest, PlaybackWithVideoTrackDisabledThenEnabled) { |
EXPECT_HASH_EQ("fd59357dfd9c144ab4fb8181b2de32c3", GetVideoHash()); |
} |
-TEST_F(PipelineIntegrationTest, TrackStatusChangesBeforePipelineStarted) { |
+TEST_P(CommonPipelineIntegrationTest, TrackStatusChangesBeforePipelineStarted) { |
std::vector<MediaTrack::Id> empty_track_ids; |
pipeline_->OnEnabledAudioTracksChanged(empty_track_ids); |
pipeline_->OnSelectedVideoTrackChanged(empty_track_ids); |
} |
-TEST_F(PipelineIntegrationTest, TrackStatusChangesAfterPipelineEnded) { |
+TEST_P(CommonPipelineIntegrationTest, TrackStatusChangesAfterPipelineEnded) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); |
Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
@@ -1027,7 +1145,7 @@ TEST_F(PipelineIntegrationTest, TrackStatusChangesAfterPipelineEnded) { |
pipeline_->OnSelectedVideoTrackChanged(track_ids); |
} |
-TEST_F(PipelineIntegrationTest, TrackStatusChangesWhileSuspended) { |
+TEST_P(CommonPipelineIntegrationTest, TrackStatusChangesWhileSuspended) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm", kHashed)); |
Play(); |
@@ -1067,7 +1185,7 @@ TEST_F(PipelineIntegrationTest, TrackStatusChangesWhileSuspended) { |
ASSERT_TRUE(WaitUntilOnEnded()); |
} |
-TEST_F(PipelineIntegrationTest, PipelineStoppedWhileAudioRestartPending) { |
+TEST_P(CommonPipelineIntegrationTest, PipelineStoppedWhileAudioRestartPending) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
Play(); |
@@ -1082,7 +1200,7 @@ TEST_F(PipelineIntegrationTest, PipelineStoppedWhileAudioRestartPending) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, PipelineStoppedWhileVideoRestartPending) { |
+TEST_P(CommonPipelineIntegrationTest, PipelineStoppedWhileVideoRestartPending) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
Play(); |
@@ -1097,8 +1215,11 @@ TEST_F(PipelineIntegrationTest, PipelineStoppedWhileVideoRestartPending) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_CLOCKLESS(BasicPlaybackOpusOggTrimmingHashed)) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackOpusOggTrimmingHashed) { |
+#if defined(DISABLE_CLOCKLESS_TESTS) |
+ return; |
+#endif // defined(DISABLE_CLOCKLESS_TESTS) |
+ |
ASSERT_EQ(PIPELINE_OK, |
Start("opus-trimming-test.webm", kHashed | kClockless)); |
@@ -1121,8 +1242,11 @@ TEST_F(PipelineIntegrationTest, |
EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_CLOCKLESS(BasicPlaybackOpusWebmTrimmingHashed)) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackOpusWebmTrimmingHashed) { |
+#if defined(DISABLE_CLOCKLESS_TESTS) |
+ return; |
+#endif // defined(DISABLE_CLOCKLESS_TESTS) |
+ |
ASSERT_EQ(PIPELINE_OK, |
Start("opus-trimming-test.webm", kHashed | kClockless)); |
@@ -1145,8 +1269,12 @@ TEST_F(PipelineIntegrationTest, |
EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_CLOCKLESS(BasicPlaybackOpusWebmTrimmingHashed_MediaSource)) { |
+TEST_P(CommonPipelineIntegrationTest, |
+ BasicPlaybackOpusWebmTrimmingHashed_MediaSource) { |
+#if defined(DISABLE_CLOCKLESS_TESTS) |
+ return; |
+#endif // defined(DISABLE_CLOCKLESS_TESTS) |
+ |
MockMediaSource source("opus-trimming-test.webm", kOpusAudioOnlyWebM, |
kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource( |
@@ -1176,8 +1304,12 @@ TEST_F(PipelineIntegrationTest, |
EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay)) { |
+TEST_P(CommonPipelineIntegrationTest, |
+ BasicPlaybackOpusPrerollExceedsCodecDelay) { |
+#if defined(DISABLE_CLOCKLESS_TESTS) |
+ return; |
+#endif // defined(DISABLE_CLOCKLESS_TESTS) |
+ |
ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless)); |
AudioDecoderConfig config = |
@@ -1200,8 +1332,12 @@ TEST_F(PipelineIntegrationTest, |
EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource)) { |
+TEST_P(CommonPipelineIntegrationTest, |
+ BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource) { |
+#if defined(DISABLE_CLOCKLESS_TESTS) |
+ return; |
+#endif // defined(DISABLE_CLOCKLESS_TESTS) |
+ |
MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM, |
kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource( |
@@ -1230,7 +1366,7 @@ TEST_F(PipelineIntegrationTest, |
EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackLive) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); |
// Live stream does not have duration in the initialization segment. |
@@ -1246,7 +1382,7 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { |
EXPECT_EQ(kLiveTimelineOffset(), demuxer_->GetTimelineOffset()); |
} |
-TEST_F(PipelineIntegrationTest, S32PlaybackHashed) { |
+TEST_P(CommonPipelineIntegrationTest, S32PlaybackHashed) { |
ASSERT_EQ(PIPELINE_OK, Start("sfx_s32le.wav", kHashed)); |
Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
@@ -1254,7 +1390,7 @@ TEST_F(PipelineIntegrationTest, S32PlaybackHashed) { |
EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, F32PlaybackHashed) { |
+TEST_P(CommonPipelineIntegrationTest, F32PlaybackHashed) { |
ASSERT_EQ(PIPELINE_OK, Start("sfx_f32le.wav", kHashed)); |
Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
@@ -1262,22 +1398,7 @@ TEST_F(PipelineIntegrationTest, F32PlaybackHashed) { |
EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, MAYBE_EME(BasicPlaybackEncrypted)) { |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- set_encrypted_media_init_data_cb( |
- base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, |
- base::Unretained(&encrypted_media))); |
- |
- ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-av_enc-av.webm", |
- encrypted_media.GetCdmContext())); |
- |
- Play(); |
- |
- ASSERT_TRUE(WaitUntilOnEnded()); |
- Stop(); |
-} |
- |
-TEST_F(PipelineIntegrationTest, FlacPlaybackHashed) { |
+TEST_P(CommonPipelineIntegrationTest, FlacPlaybackHashed) { |
ASSERT_EQ(PIPELINE_OK, Start("sfx.flac", kHashed)); |
Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
@@ -1285,7 +1406,7 @@ TEST_F(PipelineIntegrationTest, FlacPlaybackHashed) { |
EXPECT_HASH_EQ("3.03,2.86,2.99,3.31,3.57,4.06,", GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource) { |
MockMediaSource source("bear-320x240.webm", kWebM, 219229); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
@@ -1304,7 +1425,7 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Live) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_Live) { |
MockMediaSource source("bear-320x240-live.webm", kWebM, 219221); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
@@ -1323,7 +1444,7 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Live) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) { |
MockMediaSource source("bear-vp9.webm", kWebMVP9, 67504); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
@@ -1340,7 +1461,8 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_BlockGroup_WebM) { |
+TEST_P(CommonPipelineIntegrationTest, |
+ BasicPlayback_MediaSource_VP9_BlockGroup_WebM) { |
MockMediaSource source("bear-vp9-blockgroup.webm", kWebMVP9, 67871); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
@@ -1357,7 +1479,7 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_BlockGroup_WebM) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) { |
MockMediaSource source("bear-vp8a.webm", kVideoOnlyWebM, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
@@ -1374,7 +1496,7 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { |
MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
@@ -1392,7 +1514,7 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { |
} |
// Flaky. http://crbug.com/304776 |
-TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { |
+TEST_P(CommonPipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { |
MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, |
@@ -1420,7 +1542,7 @@ TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
+TEST_P(CommonPipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
@@ -1445,7 +1567,8 @@ TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, MediaSource_Remove_Updates_BufferedRanges) { |
+TEST_P(CommonPipelineIntegrationTest, |
+ MediaSource_Remove_Updates_BufferedRanges) { |
const char* input_filename = "bear-320x240.webm"; |
MockMediaSource source(input_filename, kWebM, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
@@ -1474,7 +1597,7 @@ TEST_F(PipelineIntegrationTest, MediaSource_Remove_Updates_BufferedRanges) { |
// evicted data shold be reflected in the change of media::Pipeline buffered |
// ranges (returned by GetBufferedTimeRanges). At that point the buffered ranges |
// will no longer start at 0. |
-TEST_F(PipelineIntegrationTest, MediaSource_FillUp_Buffer) { |
+TEST_P(CommonPipelineIntegrationTest, MediaSource_FillUp_Buffer) { |
const char* input_filename = "bear-320x240.webm"; |
MockMediaSource source(input_filename, kWebM, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
@@ -1504,99 +1627,8 @@ TEST_F(PipelineIntegrationTest, MediaSource_FillUp_Buffer) { |
Stop(); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(MediaSource_ConfigChange_Encrypted_WebM)) { |
- MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- |
- EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1); |
- scoped_refptr<DecoderBuffer> second_file = |
- ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
- ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
- second_file->data(), |
- second_file->data_size())); |
- source.EndOfStream(); |
- |
- Play(); |
- EXPECT_TRUE(WaitUntilOnEnded()); |
- |
- EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
- EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
- EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
- pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
- |
- source.Shutdown(); |
- Stop(); |
-} |
- |
-// Config changes from encrypted to clear are not currently supported. |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) { |
- MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- |
- scoped_refptr<DecoderBuffer> second_file = |
- ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
- |
- ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
- second_file->data(), |
- second_file->data_size())); |
- |
- source.EndOfStream(); |
- |
- base::RunLoop().Run(); |
- EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_); |
- |
- EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
- EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
- // The second video was not added, so its time has not been added. |
- EXPECT_EQ(k320WebMFileDurationMs, |
- pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
- |
- Play(); |
- |
- EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); |
- source.Shutdown(); |
-} |
- |
-// Config changes from clear to encrypted are not currently supported. |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) { |
- MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- |
- scoped_refptr<DecoderBuffer> second_file = |
- ReadTestDataFile("bear-640x360.webm"); |
- |
- ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
- second_file->data(), |
- second_file->data_size())); |
- |
- source.EndOfStream(); |
- |
- EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
- EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
- // The second video was not added, so its time has not been added. |
- EXPECT_EQ(k320EncWebMFileDurationMs, |
- pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
- |
- Play(); |
- |
- EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); |
- source.Shutdown(); |
-} |
- |
#if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_ANDROID) |
-TEST_F(PipelineIntegrationTest, BasicPlaybackHi10PVP9) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHi10PVP9) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p-vp9.webm", kClockless)); |
Play(); |
@@ -1604,7 +1636,7 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHi10PVP9) { |
ASSERT_TRUE(WaitUntilOnEnded()); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlaybackHi12PVP9) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHi12PVP9) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi12p-vp9.webm", kClockless)); |
Play(); |
@@ -1615,7 +1647,7 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHi12PVP9) { |
#if BUILDFLAG(USE_PROPRIETARY_CODECS) |
-TEST_F(PipelineIntegrationTest, BasicPlaybackHi10P) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHi10P) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p.mp4", kClockless)); |
Play(); |
@@ -1623,7 +1655,7 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHi10P) { |
ASSERT_TRUE(WaitUntilOnEnded()); |
} |
-TEST_F(PipelineIntegrationTest, BasicFallback) { |
+TEST_P(CommonPipelineIntegrationTest, BasicFallback) { |
ScopedVector<VideoDecoder> failing_video_decoder; |
failing_video_decoder.push_back(new FailingVideoDecoder()); |
@@ -1635,7 +1667,7 @@ TEST_F(PipelineIntegrationTest, BasicFallback) { |
ASSERT_TRUE(WaitUntilOnEnded()); |
}; |
-TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { |
+TEST_P(CommonPipelineIntegrationTest, MediaSource_ADTS) { |
MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
@@ -1649,7 +1681,7 @@ TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { |
EXPECT_TRUE(WaitUntilOnEnded()); |
} |
-TEST_F(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { |
+TEST_P(CommonPipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { |
MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, |
StartPipelineWithMediaSource(&source, kHashed, nullptr)); |
@@ -1680,7 +1712,7 @@ TEST_F(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { |
EXPECT_HASH_EQ("-0.25,0.67,0.04,0.14,-0.49,-0.41,", GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) { |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackHashed_MP3) { |
ASSERT_EQ(PIPELINE_OK, Start("sfx.mp3", kHashed)); |
Play(); |
@@ -1691,80 +1723,7 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) { |
EXPECT_HASH_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash()); |
} |
-#if !defined(DISABLE_CLOCKLESS_TESTS) |
-class Mp3FastSeekParams { |
- public: |
- Mp3FastSeekParams(const char* filename, const char* hash) |
- : filename(filename), hash(hash) {} |
- const char* filename; |
- const char* hash; |
-}; |
- |
-class Mp3FastSeekIntegrationTest |
- : public PipelineIntegrationTest, |
- public testing::WithParamInterface<Mp3FastSeekParams> {}; |
- |
-TEST_P(Mp3FastSeekIntegrationTest, FastSeekAccuracy_MP3) { |
- Mp3FastSeekParams config = GetParam(); |
- ASSERT_EQ(PIPELINE_OK, Start(config.filename, kHashed)); |
- |
- // The XING TOC is inaccurate. We don't use it for CBR, we tolerate it for VBR |
- // (best option for fast seeking; see Mp3SeekFFmpegDemuxerTest). The chosen |
- // seek time exposes inaccuracy in TOC such that the hash will change if seek |
- // logic is regressed. See https://crbug.com/545914. |
- // |
- // Quick TOC design (not pretty!): |
- // - All MP3 TOCs are 100 bytes |
- // - Each byte is read as a uint8_t; value between 0 - 255. |
- // - The index into this array is the numerator in the ratio: index / 100. |
- // This fraction represents a playback time as a percentage of duration. |
- // - The value at the given index is the numerator in the ratio: value / 256. |
- // This fraction represents a byte offset as a percentage of the file size. |
- // |
- // For CBR files, each frame is the same size, so the offset for time of |
- // (0.98 * duration) should be around (0.98 * file size). This is 250.88 / 256 |
- // but the numerator will be truncated in the TOC as 250, losing precision. |
- base::TimeDelta seek_time(0.98 * pipeline_->GetMediaDuration()); |
- |
- ASSERT_TRUE(Seek(seek_time)); |
- Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
- |
- EXPECT_HASH_EQ(config.hash, GetAudioHash()); |
-} |
- |
-// TODO(CHCUNNINGHAM): Re-enable for OSX once 1% flakiness is root caused. |
-// See http://crbug.com/571898 |
-#if !defined(OS_MACOSX) |
-// CBR seeks should always be fast and accurate. |
-INSTANTIATE_TEST_CASE_P( |
- CBRSeek_HasTOC, |
- Mp3FastSeekIntegrationTest, |
- ::testing::Values(Mp3FastSeekParams("bear-audio-10s-CBR-has-TOC.mp3", |
- "-0.71,0.36,2.96,2.68,2.10,-1.08,"))); |
-#endif |
- |
-INSTANTIATE_TEST_CASE_P( |
- CBRSeeks_NoTOC, |
- Mp3FastSeekIntegrationTest, |
- ::testing::Values(Mp3FastSeekParams("bear-audio-10s-CBR-no-TOC.mp3", |
- "0.95,0.56,1.34,0.47,1.77,0.84,"))); |
- |
-// VBR seeks can be fast *OR* accurate, but not both. We chose fast. |
-INSTANTIATE_TEST_CASE_P( |
- VBRSeeks_HasTOC, |
- Mp3FastSeekIntegrationTest, |
- ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-has-TOC.mp3", |
- "-0.15,-0.83,0.54,1.00,1.94,0.93,"))); |
- |
-INSTANTIATE_TEST_CASE_P( |
- VBRSeeks_NoTOC, |
- Mp3FastSeekIntegrationTest, |
- ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-no-TOC.mp3", |
- "-0.22,0.80,1.19,0.73,-0.31,-1.12,"))); |
-#endif // !defined(DISABLE_CLOCKLESS_TESTS) |
- |
-TEST_F(PipelineIntegrationTest, MediaSource_MP3) { |
+TEST_P(CommonPipelineIntegrationTest, MediaSource_MP3) { |
MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, |
StartPipelineWithMediaSource(&source, kHashed, nullptr)); |
@@ -1782,7 +1741,7 @@ TEST_F(PipelineIntegrationTest, MediaSource_MP3) { |
EXPECT_HASH_EQ("1.01,2.71,4.18,4.32,3.04,1.12,", GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { |
+TEST_P(CommonPipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { |
MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
EXPECT_EQ(313, source.last_timestamp_offset().InMilliseconds()); |
@@ -1809,7 +1768,7 @@ TEST_F(PipelineIntegrationTest, MediaSource_MP3_TimestampOffset) { |
EXPECT_EQ(613, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
} |
-TEST_F(PipelineIntegrationTest, MediaSource_MP3_Icecast) { |
+TEST_P(CommonPipelineIntegrationTest, MediaSource_MP3_Icecast) { |
MockMediaSource source("icy_sfx.mp3", kMP3, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
@@ -1819,7 +1778,7 @@ TEST_F(PipelineIntegrationTest, MediaSource_MP3_Icecast) { |
EXPECT_TRUE(WaitUntilOnEnded()); |
} |
-TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_MP4) { |
+TEST_P(CommonPipelineIntegrationTest, MediaSource_ConfigChange_MP4) { |
MockMediaSource source("bear-640x360-av_frag.mp4", kMP4, kAppendWholeFile); |
EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
@@ -1842,715 +1801,940 @@ TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_MP4) { |
source.Shutdown(); |
Stop(); |
} |
+#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly)) { |
- MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- |
- EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1); |
- scoped_refptr<DecoderBuffer> second_file = |
- ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); |
- ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
- second_file->data(), |
- second_file->data_size())); |
- source.EndOfStream(); |
- |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-16x9-aspect.webm")); |
Play(); |
- EXPECT_TRUE(WaitUntilOnEnded()); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+} |
- EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
- EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
- EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, |
- pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
+#if BUILDFLAG(USE_PROPRIETARY_CODECS) |
+TEST_P(CommonPipelineIntegrationTest, Mp2ts_AAC_HE_SBR_Audio) { |
+ MockMediaSource source("bear-1280x720-aac_he.ts", kMP2AudioSBR, |
+ kAppendWholeFile); |
+#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
+ EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
+ source.EndOfStream(); |
+ ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
- source.Shutdown(); |
- Stop(); |
+ // Check that SBR is taken into account correctly by mpeg2ts parser. When an |
+ // SBR stream is parsed as non-SBR stream, then audio frame durations are |
+ // calculated incorrectly and that leads to gaps in buffered ranges (so this |
+ // check will fail) and eventually leads to stalled playback. |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+#else |
+ EXPECT_EQ( |
+ DEMUXER_ERROR_COULD_NOT_OPEN, |
+ StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); |
+#endif |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME( |
- MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly)) { |
- MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video, |
+TEST_P(CommonPipelineIntegrationTest, |
+ BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) { |
+ MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3, |
kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- |
- EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1); |
- scoped_refptr<DecoderBuffer> second_file = |
- ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4"); |
- ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
- second_file->data(), |
- second_file->data_size())); |
+ EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
- Play(); |
- EXPECT_TRUE(WaitUntilOnEnded()); |
- |
EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
- EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, |
+ EXPECT_EQ(k1280IsoAVC3FileDurationMs, |
pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
+ Play(); |
+ |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
source.Shutdown(); |
Stop(); |
} |
-// Config changes from clear to encrypted are not currently supported. |
-// TODO(ddorwin): Figure out why this CHECKs in AppendAtTime(). |
-TEST_F(PipelineIntegrationTest, |
- DISABLED_MediaSource_ConfigChange_ClearThenEncrypted_MP4_CENC) { |
- MockMediaSource source("bear-640x360-av_frag.mp4", kMP4Video, |
+TEST_P(CommonPipelineIntegrationTest, |
+ BasicPlayback_MediaSource_VideoOnly_MP4_VP9) { |
+ MockMediaSource source("bear-320x240-v_frag-vp9.mp4", kMP4VideoVP9, |
kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- |
- EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1); |
- scoped_refptr<DecoderBuffer> second_file = |
- ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); |
- ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
- second_file->data(), |
- second_file->data_size())); |
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableVp9InMp4)) { |
+ ASSERT_EQ(ChunkDemuxer::kNotSupported, source.AddId()); |
+ return; |
+ } |
+ EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
- |
- base::RunLoop().Run(); |
- EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_); |
- |
- EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
- EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
- // The second video was not added, so its time has not been added. |
- EXPECT_EQ(k640IsoFileDurationMs, |
- pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
+ ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
Play(); |
- EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
source.Shutdown(); |
+ Stop(); |
} |
-// Config changes from encrypted to clear are not currently supported. |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC)) { |
- MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, |
+TEST_P(CommonPipelineIntegrationTest, |
+ BasicPlayback_MediaSource_VideoOnly_MP4_HEVC1) { |
+ // HEVC demuxing might be enabled even on platforms that don't support HEVC |
+ // decoding. For those cases we'll get DECODER_ERROR_NOT_SUPPORTED, which |
+ // indicates indicates that we did pass media mime type checks and attempted |
+ // to actually demux and decode the stream. On platforms that support both |
+ // demuxing and decoding we'll get PIPELINE_OK. |
+ MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC1, |
kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
+ PipelineStatus status = StartPipelineWithMediaSource(&source); |
+ EXPECT_TRUE(status == PIPELINE_OK || status == DECODER_ERROR_NOT_SUPPORTED); |
+#else |
+ EXPECT_EQ( |
+ DEMUXER_ERROR_COULD_NOT_OPEN, |
+ StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); |
+#endif |
+} |
- scoped_refptr<DecoderBuffer> second_file = |
- ReadTestDataFile("bear-1280x720-av_frag.mp4"); |
+TEST_P(CommonPipelineIntegrationTest, |
+ BasicPlayback_MediaSource_VideoOnly_MP4_HEVC2) { |
+ // HEVC demuxing might be enabled even on platforms that don't support HEVC |
+ // decoding. For those cases we'll get DECODER_ERROR_NOT_SUPPORTED, which |
+ // indicates indicates that we did pass media mime type checks and attempted |
+ // to actually demux and decode the stream. On platforms that support both |
+ // demuxing and decoding we'll get PIPELINE_OK. |
+ MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC2, |
+ kAppendWholeFile); |
+#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
+ PipelineStatus status = StartPipelineWithMediaSource(&source); |
+ EXPECT_TRUE(status == PIPELINE_OK || status == DECODER_ERROR_NOT_SUPPORTED); |
+#else |
+ EXPECT_EQ( |
+ DEMUXER_ERROR_COULD_NOT_OPEN, |
+ StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); |
+#endif |
+} |
- ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
- second_file->data(), |
- second_file->data_size())); |
+#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
- source.EndOfStream(); |
+TEST_P(CommonPipelineIntegrationTest, SeekWhilePaused) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
- EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
- EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
- // The second video was not added, so its time has not been added. |
- EXPECT_EQ(k640IsoCencFileDurationMs, |
- pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
+ base::TimeDelta duration(pipeline_->GetMediaDuration()); |
+ base::TimeDelta start_seek_time(duration / 4); |
+ base::TimeDelta seek_time(duration * 3 / 4); |
Play(); |
- |
- EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); |
- source.Shutdown(); |
-} |
- |
-// Verify files which change configuration midstream fail gracefully. |
-TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) { |
- ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3")); |
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
+ Pause(); |
+ ASSERT_TRUE(Seek(seek_time)); |
+ EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); |
Play(); |
- ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE); |
-} |
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
-TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-16x9-aspect.webm")); |
+ // Make sure seeking after reaching the end works as expected. |
+ Pause(); |
+ ASSERT_TRUE(Seek(seek_time)); |
+ EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); |
Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
} |
-TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_WebM)) { |
- MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+TEST_P(CommonPipelineIntegrationTest, SeekWhilePlaying) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
- source.EndOfStream(); |
- ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+ base::TimeDelta duration(pipeline_->GetMediaDuration()); |
+ base::TimeDelta start_seek_time(duration / 4); |
+ base::TimeDelta seek_time(duration * 3 / 4); |
Play(); |
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
+ ASSERT_TRUE(Seek(seek_time)); |
+ EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ // Make sure seeking after reaching the end works as expected. |
+ ASSERT_TRUE(Seek(seek_time)); |
+ EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
} |
-TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_ClearStart_WebM)) { |
- MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+TEST_P(CommonPipelineIntegrationTest, SuspendWhilePaused) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
- source.EndOfStream(); |
- ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+ base::TimeDelta duration(pipeline_->GetMediaDuration()); |
+ base::TimeDelta start_seek_time(duration / 4); |
+ base::TimeDelta seek_time(duration * 3 / 4); |
Play(); |
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
+ Pause(); |
+ |
+ // Suspend while paused. |
+ ASSERT_TRUE(Suspend()); |
+ |
+ // Resuming the pipeline will create a new Renderer, |
+ // which in turn will trigger video size and opacity notifications. |
+ EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))).Times(1); |
+ EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(1); |
+ ASSERT_TRUE(Resume(seek_time)); |
+ EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
+ Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_WebM)) { |
- MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+TEST_P(CommonPipelineIntegrationTest, SuspendWhilePlaying) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
- source.EndOfStream(); |
- ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+ base::TimeDelta duration(pipeline_->GetMediaDuration()); |
+ base::TimeDelta start_seek_time(duration / 4); |
+ base::TimeDelta seek_time(duration * 3 / 4); |
Play(); |
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
+ ASSERT_TRUE(Suspend()); |
+ |
+ // Resuming the pipeline will create a new Renderer, |
+ // which in turn will trigger video size and opacity notifications. |
+ EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))).Times(1); |
+ EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(1); |
+ ASSERT_TRUE(Resume(seek_time)); |
+ EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
} |
#if BUILDFLAG(USE_PROPRIETARY_CODECS) |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_MP4_CENC_VideoOnly)) { |
- MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+TEST_P(CommonPipelineIntegrationTest, Rotated_Metadata_0) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_0.mp4")); |
+ ASSERT_EQ(VIDEO_ROTATION_0, metadata_.video_rotation); |
+} |
- source.EndOfStream(); |
- ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+TEST_P(CommonPipelineIntegrationTest, Rotated_Metadata_90) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_90.mp4")); |
+ ASSERT_EQ(VIDEO_ROTATION_90, metadata_.video_rotation); |
+} |
- Play(); |
+TEST_P(CommonPipelineIntegrationTest, Rotated_Metadata_180) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_180.mp4")); |
+ ASSERT_EQ(VIDEO_ROTATION_180, metadata_.video_rotation); |
+} |
- ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
+TEST_P(CommonPipelineIntegrationTest, Rotated_Metadata_270) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_270.mp4")); |
+ ASSERT_EQ(VIDEO_ROTATION_270, metadata_.video_rotation); |
} |
+#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_MP4_CENC_AudioOnly)) { |
- MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+// Verify audio decoder & renderer can handle aborted demuxer reads. |
+TEST_P(CommonPipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) { |
+ ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM, |
+ 16384, base::TimeDelta::FromMilliseconds(464), |
+ base::TimeDelta::FromMilliseconds(617), 0x10CA, |
+ 19730)); |
+} |
- source.EndOfStream(); |
- ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+// Verify video decoder & renderer can handle aborted demuxer reads. |
+TEST_P(CommonPipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
+ ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, |
+ 32768, base::TimeDelta::FromMilliseconds(167), |
+ base::TimeDelta::FromMilliseconds(1668), |
+ 0x1C896, 65536)); |
+} |
+// Verify that Opus audio in WebM containers can be played back. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-opus-end-trimming.webm")); |
Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+} |
+// Verify that VP9 video in WebM containers can be played back. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VideoOnly_VP9_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp9.webm")); |
+ Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly)) { |
- MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+// Verify that VP9 video and Opus audio in the same WebM container can be played |
+// back. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP9_Opus_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-opus.webm")); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+} |
- source.EndOfStream(); |
+// Verify that VP8 video with alpha channel can be played back. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP8A_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a.webm")); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); |
+} |
+// Verify that VP8A video with odd width/height can be played back. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP8A_Odd_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a-odd-dimensions.webm")); |
Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); |
+} |
+// Verify that VP9 video with odd width/height can be played back. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-odd-dimensions.webm")); |
+ Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
} |
-TEST_F(PipelineIntegrationTest, Mp2ts_AAC_HE_SBR_Audio) { |
- MockMediaSource source("bear-1280x720-aac_he.ts", kMP2AudioSBR, |
- kAppendWholeFile); |
-#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
- EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
- source.EndOfStream(); |
- ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+// Verify that VP9 video with alpha channel can be played back. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP9A_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp9a.webm")); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); |
+} |
- // Check that SBR is taken into account correctly by mpeg2ts parser. When an |
- // SBR stream is parsed as non-SBR stream, then audio frame durations are |
- // calculated incorrectly and that leads to gaps in buffered ranges (so this |
- // check will fail) and eventually leads to stalled playback. |
- EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
-#else |
- EXPECT_EQ( |
- DEMUXER_ERROR_COULD_NOT_OPEN, |
- StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); |
-#endif |
+// Verify that VP9A video with odd width/height can be played back. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_VP9A_Odd_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp9a-odd-dimensions.webm")); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly)) { |
- MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+// Verify that VP9 video with 4:4:4 subsampling can be played back. |
+TEST_P(CommonPipelineIntegrationTest, P444_VP9_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-P444.webm")); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV24); |
+} |
- source.EndOfStream(); |
+// Verify that frames of VP9 video in the BT.709 color space have the YV12HD |
+// format. |
+TEST_P(CommonPipelineIntegrationTest, BT709_VP9_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-bt709.webm")); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12); |
+ EXPECT_COLOR_SPACE_EQ(last_video_frame_color_space_, COLOR_SPACE_HD_REC709); |
+} |
+TEST_P(CommonPipelineIntegrationTest, HD_VP9_WebM) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-1280x720.webm", kClockless)); |
Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+} |
+// Verify that videos with an odd frame size playback successfully. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_OddVideoSize) { |
+ ASSERT_EQ(PIPELINE_OK, Start("butterfly-853x480.webm")); |
+ Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_Video)) { |
- MockMediaSource source("bear-640x360-v_frag-cenc-senc.mp4", kMP4Video, |
- kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+// Verify that OPUS audio in a webm which reports a 44.1kHz sample rate plays |
+// correctly at 48kHz |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_Opus441kHz) { |
+ ASSERT_EQ(PIPELINE_OK, Start("sfx-opus-441.webm")); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) |
+ ->audio_decoder_config() |
+ .samples_per_second()); |
+} |
+// Same as above but using MediaSource. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) { |
+ MockMediaSource source("sfx-opus-441.webm", kOpusAudioOnlyWebM, |
+ kAppendWholeFile); |
+ EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
- |
Play(); |
- |
ASSERT_TRUE(WaitUntilOnEnded()); |
source.Shutdown(); |
Stop(); |
+ EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) |
+ ->audio_decoder_config() |
+ .samples_per_second()); |
} |
-// 'SAIZ' and 'SAIO' boxes contain redundant information which is already |
-// available in 'SENC' box. Although 'SAIZ' and 'SAIO' boxes are required per |
-// CENC spec for backward compatibility reasons, but we do not use the two |
-// boxes if 'SENC' box is present, so the code should work even if the two |
-// boxes are not present. |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_NO_SAIZ_SAIO_Video)) { |
- MockMediaSource source("bear-640x360-v_frag-cenc-senc-no-saiz-saio.mp4", |
- kMP4Video, kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+// Ensures audio-only playback with missing or negative timestamps works. Tests |
+// the common live-streaming case for chained ogg. See http://crbug.com/396864. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackChainedOgg) { |
+ ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration)); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); |
+} |
- source.EndOfStream(); |
+// Tests that we signal ended even when audio runs longer than video track. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear_audio_longer_than_video.ogv")); |
+ // Audio track is 2000ms. Video track is 1001ms. Duration should be higher |
+ // of the two. |
+ EXPECT_EQ(2000, pipeline_->GetMediaDuration().InMilliseconds()); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+} |
+// Tests that we signal ended even when audio runs shorter than video track. |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackAudioShorterThanVideo) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear_audio_shorter_than_video.ogv")); |
+ // Audio track is 500ms. Video track is 1001ms. Duration should be higher of |
+ // the two. |
+ EXPECT_EQ(1001, pipeline_->GetMediaDuration().InMilliseconds()); |
Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+} |
+TEST_P(CommonPipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
+ ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
+ Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
+ ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
+ demuxer_->GetStartTime()); |
} |
-TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Video)) { |
- MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4", |
- kMP4Video, kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
- EXPECT_EQ(PIPELINE_OK, |
- StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+#if BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
+const IntegrationTestData kIntegrationTests[] = {{PipelineType::Media}, |
+ {PipelineType::MediaRemoting}}; |
+#else |
+const IntegrationTestData kIntegrationTests[] = {{PipelineType::Media}}; |
miu
2017/03/29 01:39:14
const IntegrationTestData kIntegrationTests[] = {
xjz
2017/03/30 23:21:31
Done.
|
+#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) && !defined(MOJO_RENDERER) |
- source.EndOfStream(); |
+INSTANTIATE_TEST_CASE_P(, |
+ CommonPipelineIntegrationTest, |
+ testing::ValuesIn(kIntegrationTests)); |
+ |
+TEST_F(PipelineIntegrationTest, MAYBE_EME(BasicPlaybackEncrypted)) { |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ set_encrypted_media_init_data_cb( |
+ base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, |
+ base::Unretained(&encrypted_media))); |
+ |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-av_enc-av.webm", |
+ encrypted_media.GetCdmContext())); |
Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
Stop(); |
} |
TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Audio)) { |
- MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4", |
- kMP4Audio, kAppendWholeFile); |
- FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
+ MAYBE_EME(MediaSource_ConfigChange_Encrypted_WebM)) { |
+ MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
EXPECT_EQ(PIPELINE_OK, |
StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(640, 360))).Times(1); |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
+ ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
+ second_file->data(), |
+ second_file->data_size())); |
source.EndOfStream(); |
Play(); |
+ EXPECT_TRUE(WaitUntilOnEnded()); |
+ |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
source.Shutdown(); |
Stop(); |
} |
+// Config changes from encrypted to clear are not currently supported. |
TEST_F(PipelineIntegrationTest, |
- MAYBE_EME(EncryptedPlayback_MP4_VP9_CENC_VideoOnly)) { |
- MockMediaSource source("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVP9, |
+ MAYBE_EME(MediaSource_ConfigChange_ClearThenEncrypted_WebM)) { |
+ MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
kAppendWholeFile); |
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableVp9InMp4)) { |
- ASSERT_EQ(ChunkDemuxer::kNotSupported, source.AddId()); |
- return; |
- } |
- |
FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
EXPECT_EQ(PIPELINE_OK, |
StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- source.EndOfStream(); |
- |
- Play(); |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
- source.Shutdown(); |
- Stop(); |
-} |
+ ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
+ second_file->data(), |
+ second_file->data_size())); |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) { |
- MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3, |
- kAppendWholeFile); |
- EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
+ base::RunLoop().Run(); |
+ EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_); |
+ |
EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
- EXPECT_EQ(k1280IsoAVC3FileDurationMs, |
+ // The second video was not added, so its time has not been added. |
+ EXPECT_EQ(k320WebMFileDurationMs, |
pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); |
source.Shutdown(); |
- Stop(); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_VP9) { |
- MockMediaSource source("bear-320x240-v_frag-vp9.mp4", kMP4VideoVP9, |
- kAppendWholeFile); |
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableVp9InMp4)) { |
- ASSERT_EQ(ChunkDemuxer::kNotSupported, source.AddId()); |
- return; |
- } |
+// Config changes from clear to encrypted are not currently supported. |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_WebM)) { |
+ MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-640x360.webm"); |
+ |
+ ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
+ second_file->data(), |
+ second_file->data_size())); |
- EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
source.EndOfStream(); |
- ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+ |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ // The second video was not added, so its time has not been added. |
+ EXPECT_EQ(k320EncWebMFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); |
source.Shutdown(); |
- Stop(); |
} |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_HEVC1) { |
- // HEVC demuxing might be enabled even on platforms that don't support HEVC |
- // decoding. For those cases we'll get DECODER_ERROR_NOT_SUPPORTED, which |
- // indicates indicates that we did pass media mime type checks and attempted |
- // to actually demux and decode the stream. On platforms that support both |
- // demuxing and decoding we'll get PIPELINE_OK. |
- MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC1, |
- kAppendWholeFile); |
-#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
- PipelineStatus status = StartPipelineWithMediaSource(&source); |
- EXPECT_TRUE(status == PIPELINE_OK || status == DECODER_ERROR_NOT_SUPPORTED); |
-#else |
- EXPECT_EQ( |
- DEMUXER_ERROR_COULD_NOT_OPEN, |
- StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); |
-#endif |
-} |
- |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_HEVC2) { |
- // HEVC demuxing might be enabled even on platforms that don't support HEVC |
- // decoding. For those cases we'll get DECODER_ERROR_NOT_SUPPORTED, which |
- // indicates indicates that we did pass media mime type checks and attempted |
- // to actually demux and decode the stream. On platforms that support both |
- // demuxing and decoding we'll get PIPELINE_OK. |
- MockMediaSource source("bear-320x240-v_frag-hevc.mp4", kMP4VideoHEVC2, |
- kAppendWholeFile); |
-#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
- PipelineStatus status = StartPipelineWithMediaSource(&source); |
- EXPECT_TRUE(status == PIPELINE_OK || status == DECODER_ERROR_NOT_SUPPORTED); |
-#else |
- EXPECT_EQ( |
- DEMUXER_ERROR_COULD_NOT_OPEN, |
- StartPipelineWithMediaSource(&source, kExpectDemuxerFailure, nullptr)); |
-#endif |
-} |
+#if BUILDFLAG(USE_PROPRIETARY_CODECS) |
+#if !defined(DISABLE_CLOCKLESS_TESTS) |
+class Mp3FastSeekParams { |
+ public: |
+ Mp3FastSeekParams(const char* filename, const char* hash) |
+ : filename(filename), hash(hash) {} |
+ const char* filename; |
+ const char* hash; |
+}; |
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
+class Mp3FastSeekIntegrationTest |
+ : public PipelineIntegrationTest, |
+ public testing::WithParamInterface<Mp3FastSeekParams> {}; |
-TEST_F(PipelineIntegrationTest, SeekWhilePaused) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
+TEST_P(Mp3FastSeekIntegrationTest, FastSeekAccuracy_MP3) { |
+ Mp3FastSeekParams config = GetParam(); |
+ ASSERT_EQ(PIPELINE_OK, Start(config.filename, kHashed)); |
- base::TimeDelta duration(pipeline_->GetMediaDuration()); |
- base::TimeDelta start_seek_time(duration / 4); |
- base::TimeDelta seek_time(duration * 3 / 4); |
+ // The XING TOC is inaccurate. We don't use it for CBR, we tolerate it for VBR |
+ // (best option for fast seeking; see Mp3SeekFFmpegDemuxerTest). The chosen |
+ // seek time exposes inaccuracy in TOC such that the hash will change if seek |
+ // logic is regressed. See https://crbug.com/545914. |
+ // |
+ // Quick TOC design (not pretty!): |
+ // - All MP3 TOCs are 100 bytes |
+ // - Each byte is read as a uint8_t; value between 0 - 255. |
+ // - The index into this array is the numerator in the ratio: index / 100. |
+ // This fraction represents a playback time as a percentage of duration. |
+ // - The value at the given index is the numerator in the ratio: value / 256. |
+ // This fraction represents a byte offset as a percentage of the file size. |
+ // |
+ // For CBR files, each frame is the same size, so the offset for time of |
+ // (0.98 * duration) should be around (0.98 * file size). This is 250.88 / 256 |
+ // but the numerator will be truncated in the TOC as 250, losing precision. |
+ base::TimeDelta seek_time(0.98 * pipeline_->GetMediaDuration()); |
- Play(); |
- ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
- Pause(); |
ASSERT_TRUE(Seek(seek_time)); |
- EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); |
Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- // Make sure seeking after reaching the end works as expected. |
- Pause(); |
- ASSERT_TRUE(Seek(seek_time)); |
- EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); |
- Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_HASH_EQ(config.hash, GetAudioHash()); |
} |
-TEST_F(PipelineIntegrationTest, SeekWhilePlaying) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
+// TODO(CHCUNNINGHAM): Re-enable for OSX once 1% flakiness is root caused. |
+// See http://crbug.com/571898 |
+#if !defined(OS_MACOSX) |
+// CBR seeks should always be fast and accurate. |
+INSTANTIATE_TEST_CASE_P( |
+ CBRSeek_HasTOC, |
+ Mp3FastSeekIntegrationTest, |
+ ::testing::Values(Mp3FastSeekParams("bear-audio-10s-CBR-has-TOC.mp3", |
+ "-0.71,0.36,2.96,2.68,2.10,-1.08,"))); |
+#endif |
- base::TimeDelta duration(pipeline_->GetMediaDuration()); |
- base::TimeDelta start_seek_time(duration / 4); |
- base::TimeDelta seek_time(duration * 3 / 4); |
+INSTANTIATE_TEST_CASE_P( |
+ CBRSeeks_NoTOC, |
+ Mp3FastSeekIntegrationTest, |
+ ::testing::Values(Mp3FastSeekParams("bear-audio-10s-CBR-no-TOC.mp3", |
+ "0.95,0.56,1.34,0.47,1.77,0.84,"))); |
+// VBR seeks can be fast *OR* accurate, but not both. We chose fast. |
+INSTANTIATE_TEST_CASE_P( |
+ VBRSeeks_HasTOC, |
+ Mp3FastSeekIntegrationTest, |
+ ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-has-TOC.mp3", |
+ "-0.15,-0.83,0.54,1.00,1.94,0.93,"))); |
+INSTANTIATE_TEST_CASE_P( |
+ VBRSeeks_NoTOC, |
+ Mp3FastSeekIntegrationTest, |
+ ::testing::Values(Mp3FastSeekParams("bear-audio-10s-VBR-no-TOC.mp3", |
+ "-0.22,0.80,1.19,0.73,-0.31,-1.12,"))); |
+#endif // !defined(DISABLE_CLOCKLESS_TESTS) |
+ |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly)) { |
+ MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1); |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); |
+ ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
+ second_file->data(), |
+ second_file->data_size())); |
+ source.EndOfStream(); |
Play(); |
- ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
- ASSERT_TRUE(Seek(seek_time)); |
- EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_TRUE(WaitUntilOnEnded()); |
- // Make sure seeking after reaching the end works as expected. |
- ASSERT_TRUE(Seek(seek_time)); |
- EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
+ |
+ source.Shutdown(); |
+ Stop(); |
} |
-TEST_F(PipelineIntegrationTest, SuspendWhilePaused) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME( |
+ MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly)) { |
+ MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- base::TimeDelta duration(pipeline_->GetMediaDuration()); |
- base::TimeDelta start_seek_time(duration / 4); |
- base::TimeDelta seek_time(duration * 3 / 4); |
+ EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1); |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4"); |
+ ASSERT_TRUE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
+ second_file->data(), |
+ second_file->data_size())); |
+ source.EndOfStream(); |
Play(); |
- ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
- Pause(); |
- |
- // Suspend while paused. |
- ASSERT_TRUE(Suspend()); |
+ EXPECT_TRUE(WaitUntilOnEnded()); |
- // Resuming the pipeline will create a new Renderer, |
- // which in turn will trigger video size and opacity notifications. |
- EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))).Times(1); |
- EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(1); |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
- ASSERT_TRUE(Resume(seek_time)); |
- EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
- Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ source.Shutdown(); |
+ Stop(); |
} |
-TEST_F(PipelineIntegrationTest, SuspendWhilePlaying) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
- |
- base::TimeDelta duration(pipeline_->GetMediaDuration()); |
- base::TimeDelta start_seek_time(duration / 4); |
- base::TimeDelta seek_time(duration * 3 / 4); |
+// Config changes from clear to encrypted are not currently supported. |
+// TODO(ddorwin): Figure out why this CHECKs in AppendAtTime(). |
+TEST_F(PipelineIntegrationTest, |
+ DISABLED_MediaSource_ConfigChange_ClearThenEncrypted_MP4_CENC) { |
+ MockMediaSource source("bear-640x360-av_frag.mp4", kMP4Video, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
- Play(); |
- ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
- ASSERT_TRUE(Suspend()); |
+ EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(1280, 720))).Times(1); |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); |
+ ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
+ second_file->data(), |
+ second_file->data_size())); |
- // Resuming the pipeline will create a new Renderer, |
- // which in turn will trigger video size and opacity notifications. |
- EXPECT_CALL(*this, OnVideoNaturalSizeChange(gfx::Size(320, 240))).Times(1); |
- EXPECT_CALL(*this, OnVideoOpacityChange(true)).Times(1); |
+ source.EndOfStream(); |
- ASSERT_TRUE(Resume(seek_time)); |
- EXPECT_GE(pipeline_->GetMediaTime(), seek_time); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
-} |
+ base::RunLoop().Run(); |
+ EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_); |
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) |
-TEST_F(PipelineIntegrationTest, Rotated_Metadata_0) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_0.mp4")); |
- ASSERT_EQ(VIDEO_ROTATION_0, metadata_.video_rotation); |
-} |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ // The second video was not added, so its time has not been added. |
+ EXPECT_EQ(k640IsoFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
-TEST_F(PipelineIntegrationTest, Rotated_Metadata_90) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_90.mp4")); |
- ASSERT_EQ(VIDEO_ROTATION_90, metadata_.video_rotation); |
-} |
+ Play(); |
-TEST_F(PipelineIntegrationTest, Rotated_Metadata_180) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_180.mp4")); |
- ASSERT_EQ(VIDEO_ROTATION_180, metadata_.video_rotation); |
+ EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); |
+ source.Shutdown(); |
} |
-TEST_F(PipelineIntegrationTest, Rotated_Metadata_270) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear_rotate_270.mp4")); |
- ASSERT_EQ(VIDEO_ROTATION_270, metadata_.video_rotation); |
-} |
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
+// Config changes from encrypted to clear are not currently supported. |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC)) { |
+ MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
-// Verify audio decoder & renderer can handle aborted demuxer reads. |
-TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_AudioOnly) { |
- ASSERT_TRUE(TestSeekDuringRead("bear-320x240-audio-only.webm", kAudioOnlyWebM, |
- 16384, base::TimeDelta::FromMilliseconds(464), |
- base::TimeDelta::FromMilliseconds(617), 0x10CA, |
- 19730)); |
-} |
+ scoped_refptr<DecoderBuffer> second_file = |
+ ReadTestDataFile("bear-1280x720-av_frag.mp4"); |
-// Verify video decoder & renderer can handle aborted demuxer reads. |
-TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
- ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, |
- 32768, base::TimeDelta::FromMilliseconds(167), |
- base::TimeDelta::FromMilliseconds(1668), |
- 0x1C896, 65536)); |
-} |
+ ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
+ second_file->data(), |
+ second_file->data_size())); |
-// Verify that Opus audio in WebM containers can be played back. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-opus-end-trimming.webm")); |
- Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
-} |
+ source.EndOfStream(); |
+ |
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
+ // The second video was not added, so its time has not been added. |
+ EXPECT_EQ(k640IsoCencFileDurationMs, |
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
-// Verify that VP9 video in WebM containers can be played back. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_VideoOnly_VP9_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp9.webm")); |
Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ |
+ EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, WaitUntilEndedOrError()); |
+ source.Shutdown(); |
} |
-// Verify that VP9 video and Opus audio in the same WebM container can be played |
-// back. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Opus_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-opus.webm")); |
+// Verify files which change configuration midstream fail gracefully. |
+TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) { |
+ ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3")); |
Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
+ ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE); |
} |
+#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
+ |
+TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_WebM)) { |
+ MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
-// Verify that VP8 video with alpha channel can be played back. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a.webm")); |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
- EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Verify that VP8A video with odd width/height can be played back. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_VP8A_Odd_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp8a-odd-dimensions.webm")); |
+TEST_F(PipelineIntegrationTest, MAYBE_EME(EncryptedPlayback_ClearStart_WebM)) { |
+ MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
- EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Verify that VP9 video with odd width/height can be played back. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_VP9_Odd_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-odd-dimensions.webm")); |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_WebM)) { |
+ MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Verify that VP9 video with alpha channel can be played back. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_VP9A_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp9a.webm")); |
+#if BUILDFLAG(USE_PROPRIETARY_CODECS) |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_MP4_CENC_VideoOnly)) { |
+ MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
- EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Verify that VP9A video with odd width/height can be played back. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_VP9A_Odd_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp9a-odd-dimensions.webm")); |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_MP4_CENC_AudioOnly)) { |
+ MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
- EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12A); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Verify that VP8 video with inband text track can be played back. |
-TEST_F(PipelineIntegrationTest, MAYBE_TEXT(BasicPlayback_VP8_WebVTT_WebM)) { |
- EXPECT_CALL(*this, OnAddTextTrack(_, _)); |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp8-webvtt.webm")); |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly)) { |
+ MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// 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")); |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly)) { |
+ MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new NoResponseApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
- EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV24); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Verify that frames of VP9 video in the BT.709 color space have the YV12HD |
-// format. |
-TEST_F(PipelineIntegrationTest, BT709_VP9_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-vp9-bt709.webm")); |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_Video)) { |
+ MockMediaSource source("bear-640x360-v_frag-cenc-senc.mp4", kMP4Video, |
+ kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
- EXPECT_VIDEO_FORMAT_EQ(last_video_frame_format_, PIXEL_FORMAT_YV12); |
- EXPECT_COLOR_SPACE_EQ(last_video_frame_color_space_, COLOR_SPACE_HD_REC709); |
+ source.Shutdown(); |
+ Stop(); |
} |
-TEST_F(PipelineIntegrationTest, HD_VP9_WebM) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear-1280x720.webm", kClockless)); |
+// 'SAIZ' and 'SAIO' boxes contain redundant information which is already |
+// available in 'SENC' box. Although 'SAIZ' and 'SAIO' boxes are required per |
+// CENC spec for backward compatibility reasons, but we do not use the two |
+// boxes if 'SENC' box is present, so the code should work even if the two |
+// boxes are not present. |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_NO_SAIZ_SAIO_Video)) { |
+ MockMediaSource source("bear-640x360-v_frag-cenc-senc-no-saiz-saio.mp4", |
+ kMP4Video, kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Verify that videos with an odd frame size playback successfully. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_OddVideoSize) { |
- ASSERT_EQ(PIPELINE_OK, Start("butterfly-853x480.webm")); |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Video)) { |
+ MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4", |
+ kMP4Video, kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Verify that OPUS audio in a webm which reports a 44.1kHz sample rate plays |
-// correctly at 48kHz |
-TEST_F(PipelineIntegrationTest, BasicPlayback_Opus441kHz) { |
- ASSERT_EQ(PIPELINE_OK, Start("sfx-opus-441.webm")); |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_MP4_CENC_KeyRotation_Audio)) { |
+ MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4", |
+ kMP4Audio, kAppendWholeFile); |
+ FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
+ source.EndOfStream(); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
- EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) |
- ->audio_decoder_config() |
- .samples_per_second()); |
+ source.Shutdown(); |
+ Stop(); |
} |
-// Same as above but using MediaSource. |
-TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) { |
- MockMediaSource source("sfx-opus-441.webm", kOpusAudioOnlyWebM, |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_EME(EncryptedPlayback_MP4_VP9_CENC_VideoOnly)) { |
+ MockMediaSource source("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVP9, |
kAppendWholeFile); |
- EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); |
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableVp9InMp4)) { |
+ ASSERT_EQ(ChunkDemuxer::kNotSupported, source.AddId()); |
+ return; |
+ } |
+ |
+ FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
+ EXPECT_EQ(PIPELINE_OK, |
+ StartPipelineWithEncryptedMedia(&source, &encrypted_media)); |
+ |
source.EndOfStream(); |
+ |
Play(); |
+ |
ASSERT_TRUE(WaitUntilOnEnded()); |
source.Shutdown(); |
Stop(); |
- EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) |
- ->audio_decoder_config() |
- .samples_per_second()); |
} |
-// Ensures audio-only playback with missing or negative timestamps works. Tests |
-// the common live-streaming case for chained ogg. See http://crbug.com/396864. |
-TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { |
- ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration)); |
+#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
+ |
+// Verify that VP8 video with inband text track can be played back. |
+TEST_F(PipelineIntegrationTest, MAYBE_TEXT(BasicPlayback_VP8_WebVTT_WebM)) { |
+ EXPECT_CALL(*this, OnAddTextTrack(_, _)); |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-vp8-webvtt.webm")); |
Play(); |
ASSERT_TRUE(WaitUntilOnEnded()); |
- ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); |
} |
// Ensures audio-video playback with missing or negative timestamps fails softly |
@@ -2562,32 +2746,4 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { |
ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); |
} |
-// Tests that we signal ended even when audio runs longer than video track. |
-TEST_F(PipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear_audio_longer_than_video.ogv")); |
- // Audio track is 2000ms. Video track is 1001ms. Duration should be higher |
- // of the two. |
- EXPECT_EQ(2000, pipeline_->GetMediaDuration().InMilliseconds()); |
- Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
-} |
- |
-// Tests that we signal ended even when audio runs shorter than video track. |
-TEST_F(PipelineIntegrationTest, BasicPlaybackAudioShorterThanVideo) { |
- ASSERT_EQ(PIPELINE_OK, Start("bear_audio_shorter_than_video.ogv")); |
- // Audio track is 500ms. Video track is 1001ms. Duration should be higher of |
- // the two. |
- EXPECT_EQ(1001, pipeline_->GetMediaDuration().InMilliseconds()); |
- Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
-} |
- |
-TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
- ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
- Play(); |
- ASSERT_TRUE(WaitUntilOnEnded()); |
- ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
- demuxer_->GetStartTime()); |
-} |
- |
} // namespace media |