Bug 1256590 - Part 2 - Add a test case for skipping over false positive syncs at the beginning of an MP3 file. r=esawin a=ritu
authorJan Henning <jh+bugzilla@buttercookie.de>
Sun, 20 Mar 2016 22:08:45 +0100
changeset 323686 b7c702322cfd0e26df173656165447eb21f4c852
parent 323685 a25f2deb2d1c375e073886b035a4b0e2c08a514f
child 323687 1fbeb5120d66c87a748eb835d088b5d54b4fe9b1
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin, ritu
bugs1256590
milestone47.0a2
Bug 1256590 - Part 2 - Add a test case for skipping over false positive syncs at the beginning of an MP3 file. r=esawin a=ritu MozReview-Commit-ID: 36bY8Ouafr6
dom/media/gtest/TestMP3Demuxer.cpp
dom/media/gtest/moz.build
dom/media/gtest/small-shot-false-positive.mp3
--- a/dom/media/gtest/TestMP3Demuxer.cpp
+++ b/dom/media/gtest/TestMP3Demuxer.cpp
@@ -225,16 +225,56 @@ protected:
       res.mDemuxer = new MP3TrackDemuxer(res.mResource);
       mTargets.push_back(res);
 
       streamRes.mResource = new MockMP3StreamMediaResource(streamRes.mFilePath);
       streamRes.mDemuxer = new MP3TrackDemuxer(streamRes.mResource);
       mTargets.push_back(streamRes);
     }
 
+    {
+      MP3Resource res;
+      // This file contains a false frame sync at 34, just after the ID3 tag,
+      // which should be identified as a false positive and skipped.
+      res.mFilePath = "small-shot-false-positive.mp3";
+      res.mIsVBR = true;
+      res.mFileSize = 6845;
+      res.mMPEGLayer = 3;
+      res.mMPEGVersion = 1;
+      res.mID3MajorVersion = 4;
+      res.mID3MinorVersion = 0;
+      res.mID3Flags = 0;
+      res.mID3Size = 24;
+      res.mDuration = 336686;
+      res.mDurationError = 0.01f;
+      res.mSeekError = 0.2f;
+      res.mSampleRate = 44100;
+      res.mSamplesPerFrame = 1152;
+      res.mNumSamples = 12;
+      res.mNumTrailingFrames = 0;
+      res.mBitrate = 256000;
+      res.mSlotSize = 1;
+      res.mPrivate = 0;
+      const int syncs[] = { 54, 576, 1098, 1621, 2143, 2666, 3188, 3711, 4233,
+        4756, 5278, 5801, 6323 };
+      res.mSyncOffsets.insert(res.mSyncOffsets.begin(), syncs, syncs + 13);
+
+      // No content length can be estimated for CBR stream resources.
+      MP3Resource streamRes = res;
+      streamRes.mFileSize = -1;
+
+      res.mResource = new MockMP3MediaResource(res.mFilePath);
+      res.mDemuxer = new MP3TrackDemuxer(res.mResource);
+      mTargets.push_back(res);
+
+      streamRes.mResource = new MockMP3StreamMediaResource(streamRes.mFilePath);
+      streamRes.mDemuxer = new MP3TrackDemuxer(streamRes.mResource);
+      mTargets.push_back(streamRes);
+    }
+
     for (auto& target: mTargets) {
       ASSERT_EQ(NS_OK, target.mResource->Open(nullptr));
       ASSERT_TRUE(target.mDemuxer->Init());
     }
   }
 
   std::vector<MP3Resource> mTargets;
 };
--- a/dom/media/gtest/moz.build
+++ b/dom/media/gtest/moz.build
@@ -45,16 +45,17 @@ TEST_HARNESS_FILES.gtest += [
     '../test/gizmo.mp4',
     'dash_dashinit.mp4',
     'id3v2header.mp3',
     'mediasource_test.mp4',
     'noise.mp3',
     'noise_vbr.mp3',
     'short-zero-in-moov.mp4',
     'short-zero-inband.mov',
+    'small-shot-false-positive.mp3',
     'small-shot.mp3',
     'test.webm',
     'test_case_1224361.vp8.ivf',
     'test_case_1224363.vp8.ivf',
     'test_case_1224369.vp8.ivf',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2f1e794051e9dd05955514f15bfca0dda8f917df
GIT binary patch
literal 6845
zc%1E+c~BGSx`(@y5CU{U5)x=2VgeCC5IY1F1jn$*W<*dJal<4y2#UxK&T)o>uoD<I
znSiK4kO9OM9TlB1Bw-PPqN1py11f?#E-)w~i{!!_^xU~sr%v5l_m6w4&eN6Z{v%!e
zb$?I)-nTy=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