Bug 1259916: [MSE] P1. Fix eviction. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 28 Mar 2016 00:41:31 +1100
changeset 290690 d864ffed536fb108b28a3a0e1312f4d612ca8942
parent 290689 1a3e73c92a56afcea29ea26aad7735aba4ae904e
child 290691 732f589f694e3a5af43dacf868523bde606f5e62
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1259916, 1216460
milestone48.0a1
Bug 1259916: [MSE] P1. Fix eviction. r=gerald Bug 1216460 introduced a regression which would cause to always evict from both ends of the current track buffer. MozReview-Commit-ID: 4f01tNQ2KU8
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -470,26 +470,27 @@ TrackBuffersManager::DoEvictData(const T
       partialEvict = 0;
     }
     if (frame->mTime >= lowerLimit.ToMicroseconds()) {
       break;
     }
     partialEvict += frame->ComputedSizeOfIncludingThis();
   }
 
+  const int64_t finalSize = mSizeSourceBuffer - aSizeToEvict;
+
   if (lastKeyFrameIndex > 0) {
     MSE_DEBUG("Step1. Evicting %lld bytes prior currentTime",
               aSizeToEvict - toEvict);
     CodedFrameRemoval(
       TimeInterval(TimeUnit::FromMicroseconds(0),
                    TimeUnit::FromMicroseconds(buffer[lastKeyFrameIndex]->mTime - 1)));
   }
 
-  const int64_t finalSize = mSizeSourceBuffer - aSizeToEvict;
-  if (mSizeSourceBuffer <= finalSize || !buffer.Length()) {
+  if (mSizeSourceBuffer <= finalSize) {
     return;
   }
 
   toEvict = mSizeSourceBuffer - finalSize;
 
   // Still some to remove. Remove data starting from the end, up to 30s ahead
   // of the later of the playback time or the next sample to be demuxed.
   // 30s is a value chosen as it appears to work with YouTube.