Bug 1261900: [MSE] P2. Prevent assertion if first media segment contains no usable frames. r=gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 21 Apr 2016 21:19:47 +1000
changeset 356312 99c70883427cbcf5f9c85bb3f267ad31bb5497c8
parent 356311 b1196186b5ff01b564bf9d93e7ab421fd230466f
child 356313 e2bcc90143d2ea92947b6fbfbe3d1a2648b05871
push id16492
push userbmo:jyavenard@mozilla.com
push dateTue, 26 Apr 2016 06:48:07 +0000
reviewersgerald
bugs1261900
milestone49.0a1
Bug 1261900: [MSE] P2. Prevent assertion if first media segment contains no usable frames. r=gerald Encountered while using YouTube MSE/webm compliance test. MozReview-Commit-ID: 75Ga4TCGqMF
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1693,19 +1693,21 @@ TrackBuffersManager::InsertFrames(TrackB
   data.InsertElementsAt(trackBuffer.mNextInsertionIndex.ref(), aSamples);
   trackBuffer.mNextInsertionIndex.ref() += aSamples.Length();
 
   // Update our buffered range with new sample interval.
   trackBuffer.mBufferedRanges += aIntervals;
   // We allow a fuzz factor in our interval of half a frame length,
   // as fuzz is +/- value, giving an effective leeway of a full frame
   // length.
-  TimeIntervals range(aIntervals);
-  range.SetFuzz(trackBuffer.mLongestFrameDuration.ref() / 2);
-  trackBuffer.mSanitizedBufferedRanges += range;
+  if (aIntervals.Length()) {
+    TimeIntervals range(aIntervals);
+    range.SetFuzz(trackBuffer.mLongestFrameDuration.ref() / 2);
+    trackBuffer.mSanitizedBufferedRanges += range;
+  }
 }
 
 void
 TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
                                   TrackData& aTrackData,
                                   uint32_t aStartIndex)
 {
   TrackBuffer& data = aTrackData.mBuffers.LastElement();