Bug 1524500 - P2. Simplify logic to break loop early. r=bryce

The logic was redundant with the next step that will already remove all until the next keyframe.

Depends on D18321

Differential Revision: https://phabricator.services.mozilla.com/D18322

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-02-01 17:45:38 +00:00
Родитель 8701ff5245
Коммит 864ca81cfc
1 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -2023,7 +2023,6 @@ uint32_t TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
// timestamp greater than or equal to highest end timestamp and less than
// frame end timestamp"
TimeUnit intervalsEnd = aIntervals.GetEnd();
bool mayBreakLoop = false;
for (uint32_t i = aStartIndex; i < data.Length(); i++) {
const RefPtr<MediaRawData> sample = data[i];
if (aIntervals.ContainsWithStrictEnd(sample->mTime)) {
@ -2031,15 +2030,13 @@ uint32_t TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
firstRemovedIndex = Some(i);
}
lastRemovedIndex = i;
mayBreakLoop = false;
continue;
}
if (sample->mKeyframe && mayBreakLoop) {
if (sample->mTime >= intervalsEnd) {
// We can break the loop now. All frames up to the next keyframe will be
// removed during the next step.
break;
}
if (sample->mTime > intervalsEnd) {
mayBreakLoop = true;
}
}
if (firstRemovedIndex.isNothing()) {