Bug 1296531 - Allow MediaSegment::AppendSlice to combine with last chunk. r=jesup

This makes it consistent with MediaSegment::AppendFrom.

MozReview-Commit-ID: JNvLlURAqE7

--HG--
extra : rebase_source : 2fa023c91c43c19c3df799bab64f275c72eb1994
extra : source : d2c4bebc340fbd579450b42e271181e20f475c59
This commit is contained in:
Andreas Pehrson 2017-05-08 11:39:08 +02:00
Родитель fa90a37a68
Коммит 3822256061
1 изменённых файлов: 8 добавлений и 1 удалений

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

@ -461,8 +461,15 @@ protected:
StreamTime nextOffset = offset + c.GetDuration();
StreamTime end = std::min(aEnd, nextOffset);
if (start < end) {
if (!mChunks.IsEmpty() &&
mChunks[mChunks.Length() - 1].CanCombineWithFollowing(c)) {
MOZ_ASSERT(start - offset >= 0 && end - offset <= aSource.mDuration,
"Slice out of bounds");
mChunks[mChunks.Length() - 1].mDuration += end - start;
} else {
mChunks.AppendElement(c)->SliceTo(start - offset, end - offset);
}
}
offset = nextOffset;
}
}