Bug 1207946: [MSE] P3. Reset cached demuxing index when new data overwrite the end. r=gerald

This will force an iterative search upon the next demux request.
This commit is contained in:
Jean-Yves Avenard 2015-09-29 09:34:59 +10:00
Родитель 488a0d19d9
Коммит 7ae057dc90
2 изменённых файлов: 10 добавлений и 5 удалений

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

@ -1660,11 +1660,14 @@ TrackBuffersManager::InsertFrames(TrackBuffer& aSamples,
}
// Adjust our demuxing index if necessary.
if (trackBuffer.mNextGetSampleIndex.isSome() &&
(trackBuffer.mNextInsertionIndex.ref() < trackBuffer.mNextGetSampleIndex.ref() ||
(trackBuffer.mNextInsertionIndex.ref() == trackBuffer.mNextGetSampleIndex.ref() &&
aIntervals.GetEnd() < trackBuffer.mNextSampleTime))) {
trackBuffer.mNextGetSampleIndex.ref() += aSamples.Length();
if (trackBuffer.mNextGetSampleIndex.isSome()) {
if (trackBuffer.mNextInsertionIndex.ref() == trackBuffer.mNextGetSampleIndex.ref() &&
aIntervals.GetEnd() >= trackBuffer.mNextSampleTime) {
MSE_DEBUG("Next sample to be played got overwritten");
trackBuffer.mNextGetSampleIndex.reset();
} else if (trackBuffer.mNextInsertionIndex.ref() <= trackBuffer.mNextGetSampleIndex.ref()) {
trackBuffer.mNextGetSampleIndex.ref() += aSamples.Length();
}
}
TrackBuffer& data = trackBuffer.mBuffers.LastElement();

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

@ -263,6 +263,8 @@ private:
nsRefPtr<SharedTrackInfo> mLastInfo;
// If set, position of the next sample to be retrieved by GetSample().
// If the position is equal to the TrackBuffer's length, it indicates that
// we've reached EOS.
Maybe<uint32_t> mNextGetSampleIndex;
// Approximation of the next sample's decode timestamp.
media::TimeUnit mNextSampleTimecode;