Bug 1272964: [MSE] P5. Default to skipping to the next keyframe if no keyframe was found past currentTime. r=cpearce

If no keyframe are found after our time threshold, we can still skip to another keyframe (despite being prior the desired time).
So this is just a workaround for our inability to tell the MDSM when to enter buffering mode and instead the MDSM incorrectly uses the time of the last frame returned.

MozReview-Commit-ID: 5sGULpvqY5m

--HG--
extra : rebase_source : 392fe16a00eb9e10812ba4ada2e4e7c4e4aaa016
This commit is contained in:
Jean-Yves Avenard 2016-05-19 15:37:34 +08:00
Родитель 90596205d1
Коммит aafa084df3
1 изменённых файлов: 24 добавлений и 4 удалений

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

@ -1939,6 +1939,7 @@ TrackBuffersManager::SkipToNextRandomAccessPoint(TrackInfo::TrackType aTrack,
TimeUnit nextSampleTimecode = trackData.mNextSampleTimecode; TimeUnit nextSampleTimecode = trackData.mNextSampleTimecode;
TimeUnit nextSampleTime = trackData.mNextSampleTime; TimeUnit nextSampleTime = trackData.mNextSampleTime;
uint32_t i = trackData.mNextGetSampleIndex.ref(); uint32_t i = trackData.mNextGetSampleIndex.ref();
int32_t originalPos = i;
for (; i < track.Length(); i++) { for (; i < track.Length(); i++) {
const MediaRawData* sample = const MediaRawData* sample =
@ -1964,10 +1965,29 @@ TrackBuffersManager::SkipToNextRandomAccessPoint(TrackInfo::TrackType aTrack,
// Adjust the next demux time and index so that the next call to // Adjust the next demux time and index so that the next call to
// SkipToNextRandomAccessPoint will not count again the parsed sample as // SkipToNextRandomAccessPoint will not count again the parsed sample as
// skipped. // skipped.
trackData.mNextSampleTimecode = nextSampleTimecode; if (aFound) {
trackData.mNextSampleTime = nextSampleTime; trackData.mNextSampleTimecode = nextSampleTimecode;
trackData.mNextGetSampleIndex = Some(i); trackData.mNextSampleTime = nextSampleTime;
trackData.mNextGetSampleIndex = Some(i);
} else if (i > 0) {
// Go back to the previous keyframe or the original position so the next
// demux can succeed and be decoded.
for (int j = i - 1; j >= originalPos; j--) {
const RefPtr<MediaRawData>& sample = track[j];
if (sample->mKeyframe) {
trackData.mNextSampleTimecode =
TimeUnit::FromMicroseconds(sample->mTimecode);
trackData.mNextSampleTime = TimeUnit::FromMicroseconds(sample->mTime);
trackData.mNextGetSampleIndex = Some(uint32_t(j));
// We are unable to skip to a keyframe past aTimeThreshold, however
// we are speeding up decoding by dropping the unplayable frames.
// So we can mark aFound as true.
aFound = true;
break;
}
parsed--;
}
}
return parsed; return parsed;
} }