Bug 1022913 - Ensure that fastSeek() doesn't skip behind the current playback position if we're seeking forwards. r=cajbir

This commit is contained in:
Chris Pearce
2014-06-17 15:27:46 +12:00
parent 1c51e9400a
commit b19a922e8e
3 changed files with 94 additions and 0 deletions

View File

@@ -1966,6 +1966,25 @@ void MediaDecoderStateMachine::DecodeSeek()
video = mReader->FindStartTime(nextSampleStartTime);
}
if (seekTime > mediaTime &&
nextSampleStartTime < mediaTime &&
mSeekTarget.mType == SeekTarget::PrevSyncPoint) {
// We are doing a fastSeek, but we ended up *before* the previous
// playback position. This is surprising UX, so switch to an accurate
// seek and decode to the seek target. This is not conformant to the
// spec, fastSeek should always be fast, but until we get the time to
// change all Readers to seek to the keyframe after the currentTime
// in this case, we'll just decode forward. Bug 1026330.
ResetPlayback();
{
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
res = mReader->DecodeToTarget(seekTime);
if (NS_SUCCEEDED(res)) {
video = mReader->FindStartTime(nextSampleStartTime);
}
}
}
// Setup timestamp state.
if (seekTime == mEndTime) {
newCurrentTime = mAudioStartTime = seekTime;