Index: media/test/pipeline_integration_test.cc |
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc |
index b3c7349bd67b258cb653a654e345a1f456ea5b8a..c8613a1537e7933080de481ea08fe7a01735f07c 100644 |
--- a/media/test/pipeline_integration_test.cc |
+++ b/media/test/pipeline_integration_test.cc |
@@ -155,6 +155,12 @@ static const char kOpusEndTrimmingHash_2[] = |
// The above hash, plus an additional playthrough starting from T=6.36s. |
static const char kOpusEndTrimmingHash_3[] = |
"-13.28,-14.35,-13.67,-11.68,-10.18,-10.46,"; |
+// Hash for a full playthrough of "bear-opus.webm". |
chcunningham
2016/07/22 01:50:28
TODO - impl fixed point hashes too.
chcunningham
2016/12/01 17:07:16
Will do fixed point in a following PS. For now I'v
wolenetz
2016/12/02 00:18:49
Acknowledged.
|
+static const char kOpusSmallCodecDelayHash_1[] = |
+ "-0.47,-0.09,1.28,1.07,1.55,-0.22,"; |
+// The above hash, plus an additional plathrough starting from T=1.414s. |
wolenetz
2016/07/25 21:49:02
nit: 1.414 --> put in a constant?
chcunningham
2016/12/01 17:07:16
Eh. Its the same pattern used with kOpusEndTrimmin
wolenetz
2016/12/02 00:18:49
Acknowledged.
|
+static const char kOpusSmallCodecDelayHash_2[] = |
+ "0.31,0.15,-0.18,0.25,0.70,0.84,"; |
#endif // defined(OPUS_FIXED_POINT) |
#endif // !defined(MOJO_RENDERER) |
@@ -1102,9 +1108,50 @@ TEST_F(PipelineIntegrationTest, |
EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); |
} |
-// TODO(dalecurtis): Add an opus test file which FFmpeg and ChunkDemuxer will |
-// both seek the same in and shows the difference of preroll. |
-// http://crbug.com/509894 |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay)) { |
+ ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless)); |
+ |
+ AudioDecoderConfig config = |
+ demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config(); |
+ |
+ // Verify that this file's preroll is not eclipsed by the codec delay so we |
wolenetz
2016/07/25 21:49:02
nit: please do the same verification in the MSE ve
chcunningham
2016/12/01 17:07:16
Done.
|
+ // can detect when preroll is not properly performed. |
+ base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD( |
+ static_cast<double>(config.codec_delay()) / config.samples_per_second()); |
+ ASSERT_GT(config.seek_preroll(), codec_delay); |
+ |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash()); |
+ |
+ // Seek halfway through the file to invoke seek preroll. |
+ ASSERT_TRUE(Seek(base::TimeDelta::FromSecondsD(1.414))); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); |
+} |
+ |
+TEST_F(PipelineIntegrationTest, |
+ MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource)) { |
+ MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM, |
+ kAppendWholeFile); |
+ EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource( |
+ &source, kClockless | kHashed, nullptr)); |
+ source.EndOfStream(); |
+ |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash()); |
+ |
+ // Seek halfway through the file to invoke seek preroll. |
+ base::TimeDelta seek_time = base::TimeDelta::FromSecondsD(1.414); |
+ source.Seek(seek_time); |
+ ASSERT_TRUE(Seek(seek_time)); |
+ Play(); |
+ ASSERT_TRUE(WaitUntilOnEnded()); |
+ EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); |
+} |
TEST_F(PipelineIntegrationTest, BasicPlaybackLive) { |
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed)); |