Bug 1276184: [MSE] P1. Scan where to start removing frames from the start if new block added starts with a keyframe. r=kamidphish
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 02 Jun 2016 16:40:43 +1000
changeset 339316 fa6a1c27983f8ed49f42ac94bcbf1e759e3993e1
parent 339315 ecdb77ae56812fff63dc9bd7633bc976b2813980
child 339317 0567d1267d23c95d078e85caae5c9366faad3f74
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskamidphish
bugs1276184
milestone49.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 1276184: [MSE] P1. Scan where to start removing frames from the start if new block added starts with a keyframe. r=kamidphish We keep the next position on where to add frames so that we do not break the current coded frame group. However, when the new group of added frames starts with a keyframe we do not have to worry about breaking the previous coded frame group. MozReview-Commit-ID: G81xGuSa4Y2
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1619,16 +1619,22 @@ 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) {
+      // 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.
+      trackBuffer.mNextInsertionIndex.reset();
+    }
     RemoveFrames(aIntervals, trackBuffer, trackBuffer.mNextInsertionIndex.refOr(0));
   }
 
   // 16. Add the coded frame with the presentation timestamp, decode timestamp, and frame duration to the track buffer.
   if (!CheckNextInsertionIndex(aTrackData,
                                TimeUnit::FromMicroseconds(aSamples[0]->mTime))) {
     RejectProcessing(NS_ERROR_FAILURE, __func__);
     return;