Bug 1285987: Narrow the workaround added in bug 1276184 to only be effective with webm. r=gerald, a=gchang
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 13 Jul 2016 21:20:50 +1000
changeset 335648 8b6506beee8e4f591a15099cfad20fd27405a94a
parent 335647 f8606cd63ad2230a571df7e8c9260746bf8051b4
child 335649 14933537adf425ecb70af356f29d801a3f12a67a
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, gchang
bugs1285987, 1276184
milestone48.0
Bug 1285987: Narrow the workaround added in bug 1276184 to only be effective with webm. r=gerald, a=gchang Some invalid streams incorrectly tag all frames as keyframes, which cause the frames to be inserted in the wrong order in the trackbuffer. MozReview-Commit-ID: EZurdiMxmle
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1622,20 +1622,27 @@ TrackBuffersManager::InsertFrames(TrackB
 
   // 15. Remove decoding dependencies of the coded frames removed in the previous step:
   // Remove all coded frames between the coded frames removed in the previous step and the next random access point after those removed frames.
 
   TimeIntervals intersection = trackBuffer.mBufferedRanges;
   intersection.Intersection(aIntervals);
 
   if (intersection.Length()) {
-    if (aSamples[0]->mKeyframe) {
+    if (aSamples[0]->mKeyframe &&
+        (mType.LowerCaseEqualsLiteral("video/webm") ||
+         mType.LowerCaseEqualsLiteral("audio/webm"))) {
       // We are starting a new GOP, we do not have to worry about breaking an
       // existing current coded frame group. Reset the next insertion index
       // so the search for when to start our frames removal can be exhaustive.
+      // This is a workaround for bug 1276184 and only until either bug 1277733
+      // or bug 1209386 is fixed.
+      // With the webm container, we can't always properly determine the
+      // duration of the last frame, which may cause the last frame of a cluster
+      // to overlap the following frame.
       trackBuffer.mNextInsertionIndex.reset();
     }
     size_t index =
       RemoveFrames(aIntervals, trackBuffer, trackBuffer.mNextInsertionIndex.refOr(0));
     if (index) {
       trackBuffer.mNextInsertionIndex = Some(index);
     }
   }