Bug 1533211 - Remove assertion for if MP4 sample description index is invalid. r=jya
authorBryce Van Dyk <bvandyk@mozilla.com>
Fri, 03 May 2019 00:38:10 +0000
changeset 531299 9de7d7669f41a5df9c61b753767a5713aa9b965d
parent 531298 acbe63c7a420bbc2171a1f3377496f1421ba94ae
child 531300 871aff9c35e95c2d7754b8cef7c14a7155204f15
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1533211, 1547328
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533211 - Remove assertion for if MP4 sample description index is invalid. r=jya It's possible for a malformed mp4 to contain invalid sample description index in fragments, that do not reference any sample description entries found in the header. E.g. the header may contain 2 sample description entries (which should be indexed with indices 1 and 2), but for a fragment to contain an index to 4. Instead of asserting in this case we should gracefully fail. Bug 1547328 plans to add logging for this case, so we have a means to still detect failures here from bad files. Depends on D29733 Differential Revision: https://phabricator.services.mozilla.com/D29734
dom/media/mp4/Index.cpp
--- a/dom/media/mp4/Index.cpp
+++ b/dom/media/mp4/Index.cpp
@@ -249,19 +249,17 @@ SampleDescriptionEntry* SampleIterator::
   Moof& currentMoof = moofs[mCurrentMoof];
   uint32_t sampleDescriptionIndex =
       currentMoof.mTfhd.mDefaultSampleDescriptionIndex;
   // Mp4 indices start at 1, shift down 1 so we index our array correctly.
   sampleDescriptionIndex--;
   FallibleTArray<SampleDescriptionEntry>& sampleDescriptions =
       mIndex->mMoofParser->mSampleDescriptions;
   if (sampleDescriptionIndex >= sampleDescriptions.Length()) {
-    MOZ_ASSERT_UNREACHABLE(
-        "Should always be able to find the appropriate sample description! "
-        "Malformed mp4?");
+    // The sample description index is invalid, the mp4 is malformed. Bail out.
     return nullptr;
   }
   return &sampleDescriptions[sampleDescriptionIndex];
 }
 
 CencSampleEncryptionInfoEntry* SampleIterator::GetSampleEncryptionEntry() {
   nsTArray<Moof>& moofs = mIndex->mMoofParser->Moofs();
   Moof* currentMoof = &moofs[mCurrentMoof];