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

Unified Diff: media/test/pipeline_integration_test.cc

Issue 1260193005: Fix incorrect opus seek preroll and flaky pre-skip removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test cases. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/test/pipeline_integration_test.cc
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index feecbe6bbf762f3864e88e4b2829688dd2cf4842..e3a0127cde728d1760acd0f631f08cceef0777d1 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -487,6 +487,13 @@ class MockMediaSource {
AppendData(seek_append_size);
}
+ void Seek(base::TimeDelta seek_time) {
+ chunk_demuxer_->StartWaitingForSeek(seek_time);
+ chunk_demuxer_->Abort(
+ kSourceId,
+ base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_);
+ }
+
void AppendData(int size) {
DCHECK(chunk_demuxer_);
DCHECK_LT(current_position_, file_data_->data_size());
@@ -678,6 +685,12 @@ class PipelineIntegrationTest : public PipelineIntegrationTestHost {
StartPipelineWithMediaSource(source);
}
+ void StartHashedClocklessPipelineWithMediaSource(MockMediaSource* source) {
+ hashing_enabled_ = true;
+ clockless_playback_ = true;
+ StartPipelineWithMediaSource(source);
+ }
+
void StartPipelineWithEncryptedMedia(
MockMediaSource* source,
FakeEncryptedMedia* encrypted_media) {
@@ -784,6 +797,85 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHashed) {
EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null());
}
+TEST_F(PipelineIntegrationTest, BasicPlaybackOpusOggTrimmingHashed) {
+ ASSERT_EQ(PIPELINE_OK,
+ Start("opus-trimming-test.webm", kHashed | kClockless));
+
+ Play();
+
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,", GetAudioHash());
+
+ // Seek within the pre-skip section, this should not cause a beep.
+ ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1)));
+ Play();
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-13.37,-12.74,-10.02,-8.76,-9.25,-11.33,", GetAudioHash());
+
+ // Seek somewhere outside of the pre-skip / end-trim section, demxuer should
+ // correctly preroll enough to accurately decode this segment.
+ ASSERT_TRUE(Seek(pipeline_->GetMediaDuration() / 2));
+ Play();
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-14.28,-14.28,-13.46,-12.81,-12.09,-12.82,", GetAudioHash());
+}
+
+TEST_F(PipelineIntegrationTest, BasicPlaybackOpusWebmTrimmingHashed) {
+ ASSERT_EQ(PIPELINE_OK,
+ Start("opus-trimming-test.webm", kHashed | kClockless));
+
+ Play();
+
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,", GetAudioHash());
+
+ // Seek within the pre-skip section, this should not cause a beep.
+ ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1)));
+ Play();
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-13.37,-12.74,-10.02,-8.76,-9.25,-11.33,", GetAudioHash());
+
+ // Seek somewhere outside of the pre-skip / end-trim section, demxuer should
+ // correctly preroll enough to accurately decode this segment.
+ ASSERT_TRUE(Seek(pipeline_->GetMediaDuration() / 2));
+ Play();
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-14.28,-14.28,-13.46,-12.81,-12.09,-12.82,", GetAudioHash());
+}
+
+TEST_F(PipelineIntegrationTest,
+ BasicPlaybackOpusWebmTrimmingHashed_MediaSource) {
+ MockMediaSource source("opus-trimming-test.webm", kOpusAudioOnlyWebM,
+ kAppendWholeFile);
+ StartHashedClocklessPipelineWithMediaSource(&source);
+ source.EndOfStream();
+
+ Play();
+
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-4.56,-5.65,-6.51,-6.29,-4.36,-3.59,", GetAudioHash());
+
+ // TODO(chcunningham): MSE can't pass the following tests currently because it
+ // does not provide enough preroll to the opus decoder for accurate decode.
+ // See http://crbug.com/509894 for more information.
+#if 0
+ // Seek within the pre-skip section, this should not cause a beep.
+ source.Seek(base::TimeDelta::FromSeconds(1));
+ ASSERT_TRUE(Seek(base::TimeDelta::FromSeconds(1)));
+ Play();
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-13.37,-12.74,-10.02,-8.76,-9.25,-11.33,", GetAudioHash());
+
+ // Seek somewhere outside of the pre-skip / end-trim section, demxuer should
+ // correctly preroll enough to accurately decode this segment.
+ source.Seek(pipeline_->GetMediaDuration() / 2);
+ ASSERT_TRUE(Seek(pipeline_->GetMediaDuration() / 2));
+ Play();
+ ASSERT_TRUE(WaitUntilOnEnded());
+ EXPECT_HASH_EQ("-14.28,-14.28,-13.46,-12.81,-12.09,-12.82,", GetAudioHash());
+#endif
+}
+
TEST_F(PipelineIntegrationTest, BasicPlaybackLive) {
ASSERT_EQ(PIPELINE_OK, Start("bear-320x240-live.webm", kHashed));

Powered by Google App Engine
This is Rietveld 408576698