Bug 1481397 - Properly recalculate highest start timestamp when samples are removed. r=bryce, a=RyanVM
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 07 Aug 2018 11:32:37 +0200
changeset 481044 809e1c8c76ab93bdd3d347133922c2070311fd37
parent 481043 809eb582affd16253b232eefe23631d4b33629bd
child 481045 bc6e295b9a0b2ec46e5dd05a0c3467a36bf3964f
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce, RyanVM
bugs1481397
milestone62.0
Bug 1481397 - Properly recalculate highest start timestamp when samples are removed. r=bryce, a=RyanVM Summary: When removing frames from the trackbuffer we may remove frames outside the original removal interval as we must remove all frames depending on the removed frames. Differential Revision: https://phabricator.services.mozilla.com/D2837
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -2081,17 +2081,18 @@ TrackBuffersManager::RemoveFrames(const 
 
   // Recalculate sanitized buffered ranges.
   aTrackData.mSanitizedBufferedRanges = aTrackData.mBufferedRanges;
   aTrackData.mSanitizedBufferedRanges.SetFuzz(maxSampleDuration/2);
 
   data.RemoveElementsAt(firstRemovedIndex.ref(),
                         lastRemovedIndex - firstRemovedIndex.ref() + 1);
 
-  if (aIntervals.GetEnd() >= aTrackData.mHighestStartTimestamp) {
+  if (removedIntervals.GetEnd() >= aTrackData.mHighestStartTimestamp &&
+      removedIntervals.GetStart() <= aTrackData.mHighestStartTimestamp) {
     // The sample with the highest presentation time got removed.
     // Rescan the trackbuffer to determine the new one.
     TimeUnit highestStartTime;
     for (const auto& sample : data) {
       if (sample->mTime > highestStartTime) {
         highestStartTime = sample->mTime;
       }
     }