From fc260afed44460c53b4dea59781b3697ddfed9ee Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 28 Feb 2019 02:34:04 +0000 Subject: [PATCH] Bug 1531201 - Don't assume all frames' time is greater than 0. r=gerald We now allow frames to have a negative time (so that they can be decoded and trimmed). Differential Revision: https://phabricator.services.mozilla.com/D21474 --HG-- extra : moz-landing-system : lando --- dom/media/mediasource/TrackBuffersManager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index 06b20a87ffb8..b9b049a9f2c1 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -521,9 +521,12 @@ void TrackBuffersManager::DoEvictData(const TimeUnit& aPlaybackTime, if (lastKeyFrameIndex > 0) { MSE_DEBUG("Step1. Evicting %" PRId64 " bytes prior currentTime", aSizeToEvict - toEvict); - CodedFrameRemoval(TimeInterval( - TimeUnit::Zero(), - buffer[lastKeyFrameIndex]->mTime - TimeUnit::FromMicroseconds(1))); + TimeUnit start = track.mBufferedRanges[0].mStart; + TimeUnit end = + buffer[lastKeyFrameIndex]->mTime - TimeUnit::FromMicroseconds(1); + if (end > start) { + CodedFrameRemoval(TimeInterval(start, end)); + } } if (mSizeSourceBuffer <= finalSize) {