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

Unified Diff: media/test/pipeline_integration_test.cc

Issue 1492163002: Roll ffmpeg DEPS for MP3 seek bug, add tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS update Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/test/pipeline_integration_test.cc
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index 43bb528acf7229ec0fc0c809d210b3d120b2179e..81ceed85bf846820c17d73fd48217927594347bf 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -1229,6 +1229,62 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) {
EXPECT_HASH_EQ("1.30,2.72,4.56,5.08,3.74,2.03,", GetAudioHash());
}
+class Mp3SeekTestParams {
+ public:
+ Mp3SeekTestParams(const char* filename, const char* hash)
+ : filename(filename), hash(hash) {}
+ const char* filename;
+ const char* hash;
+};
+class Mp3SeekPipelineIntegrationTest
ddorwin 2015/12/03 23:07:54 nit: Why now empty lines around this class?
chcunningham 2015/12/04 02:29:55 Fixed
+ : public PipelineIntegrationTest,
+ public testing::WithParamInterface<Mp3SeekTestParams> {};
+TEST_P(Mp3SeekPipelineIntegrationTest, FastSeekAccuracy_MP3) {
ddorwin 2015/12/03 23:07:54 Should we have such tests for other types?
chcunningham 2015/12/04 02:29:55 No, this fastseek thing is mp3 specific. See https
+ Mp3SeekTestParams config = GetParam();
+ ASSERT_EQ(PIPELINE_OK, Start(config.filename, kHashed));
ddorwin 2015/12/03 23:07:54 None of the ASSERTed items will cause a crash. Gen
chcunningham 2015/12/04 02:29:55 Leaving to match the other tests in this file
+
+ base::TimeDelta duration(pipeline_->GetMediaDuration());
+
+ // NOTE this seek time of (.3 * duration) is deliberately chosen to expose
ddorwin 2015/12/03 23:07:53 nit: 0.3? Also, below.
chcunningham 2015/12/04 02:29:55 Done.
+ // loss of precision in the MP3 TOC for CBR. Quick TOC design (not pretty!):
+ // - All MP3 TOCs are 100 bytes
+ // - Each byte is read as a uint8, value between 0 - 255.
ddorwin 2015/12/03 23:07:54 nit: remove the comma or replace it with something
chcunningham 2015/12/04 02:29:55 Done.
+ // - 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
+ // (.3 * duration) should be around (.3 * file size). This is 78.8 / 256,
ddorwin 2015/12/03 23:07:54 7_6_.8?
chcunningham 2015/12/04 02:29:55 Done.
+ // but the numerator will be truncated in the TOC as 78, loosing precision.
ddorwin 2015/12/03 23:07:53 76?
chcunningham 2015/12/04 02:29:55 Done.
+ //
+ // TLDR:
ddorwin 2015/12/03 23:07:53 This comment block should probably be external to
chcunningham 2015/12/04 02:29:55 Reordered and condensed
+ // The TOC is inaccurate. We don't use it for CBR, we tolerate it for VBR (for
+ // faster seeking, see Mp3SeekFFmpegDemuxerTest). The chosen seek time
ddorwin 2015/12/03 23:07:54 nit: semicolon instead of colon? This isn't intend
chcunningham 2015/12/04 02:29:55 Done.
+ // exposes inaccuracy in TOC such that the hash will change if seek logic is
+ // regressed. See https://crbug.com/545914.
+ base::TimeDelta seek_time(.3 * duration);
+ base::TimeDelta end_time = seek_time + base::TimeDelta::FromMilliseconds(500);
+
+ ASSERT_TRUE(Seek(seek_time));
+ Play();
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(end_time));
ddorwin 2015/12/03 23:07:54 Is this call somehow frame-accurate? Otherwise, th
chcunningham 2015/12/04 02:29:55 Great catch! reworked the test to play from near-e
+
+ EXPECT_HASH_EQ(config.hash, GetAudioHash());
+}
+
+INSTANTIATE_TEST_CASE_P(
+ ,
ddorwin 2015/12/03 23:07:54 ?
chcunningham 2015/12/04 02:29:55 Wasn't using this, but I broke up the tests now in
+ Mp3SeekPipelineIntegrationTest,
+ ::testing::Values(Mp3SeekTestParams("bear-audio-10s-CBR-has-TOC.mp3",
+ "0.06,0.10,-0.32,0.08,0.52,0.78,"),
+ Mp3SeekTestParams("bear-audio-10s-CBR-no-TOC.mp3",
+ "-0.08,0.06,0.34,0.65,1.01,0.57,"),
+ Mp3SeekTestParams("bear-audio-10s-VBR-has-TOC.mp3",
+ "-0.02,-0.11,0.02,0.49,1.16,0.88,"),
+ Mp3SeekTestParams("bear-audio-10s-VBR-no-TOC.mp3",
+ "0.40,0.22,0.36,0.40,1.21,0.91,")));
+
TEST_F(PipelineIntegrationTest, MediaSource_MP3) {
MockMediaSource source("sfx.mp3", kMP3, kAppendWholeFile);
StartHashedPipelineWithMediaSource(&source);
« no previous file with comments | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698