Bug 1189138: [MSE] P3. Properly shift our demuxing index when data is added. r=gerald

Should frames be added before our current demuxing position, we must shift the index ; otherwise the next retrieved frames will be the wrong one.
This commit is contained in:
Jean-Yves Avenard 2015-07-30 14:03:44 +10:00
Родитель 024aff6746
Коммит 625eecf933
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -1515,6 +1515,12 @@ TrackBuffersManager::InsertFrames(TrackBuffer& aSamples,
CheckNextInsertionIndex(aTrackData,
TimeUnit::FromMicroseconds(aSamples[0]->mTime));
// Adjust our demuxing index if necessary.
if (trackBuffer.mNextGetSampleIndex.isSome() &&
trackBuffer.mNextInsertionIndex.ref() <= trackBuffer.mNextGetSampleIndex.ref()) {
trackBuffer.mNextGetSampleIndex.ref() += aSamples.Length();
}
TrackBuffer& data = trackBuffer.mBuffers.LastElement();
data.InsertElementsAt(trackBuffer.mNextInsertionIndex.ref(), aSamples);
trackBuffer.mNextInsertionIndex.ref() += aSamples.Length();