Bug 1269408: P7. Start skip to next keyframe logic when resume point is behind current time. r?gerald
There is no point decoding up to the internal seek time if it's already behind the current playback time.
MozReview-Commit-ID: ErPrjEPFCOH
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -484,17 +484,20 @@ bool
MediaFormatReader::ShouldSkip(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold)
{
MOZ_ASSERT(HasVideo());
media::TimeUnit nextKeyframe;
nsresult rv = mVideo.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe);
if (NS_FAILED(rv)) {
return aSkipToNextKeyframe;
}
- return nextKeyframe < aTimeThreshold && nextKeyframe.ToMicroseconds() >= 0;
+ return (nextKeyframe < aTimeThreshold ||
+ (mVideo.mTimeThreshold &&
+ mVideo.mTimeThreshold.ref().mTime < aTimeThreshold)) &&
+ nextKeyframe.ToMicroseconds() >= 0;
}
RefPtr<MediaDecoderReader::MediaDataPromise>
MediaFormatReader::RequestVideoData(bool aSkipToNextKeyframe,
int64_t aTimeThreshold)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_DIAGNOSTIC_ASSERT(mSeekPromise.IsEmpty(), "No sample requests allowed while seeking");