Bug 1089586: Abort pending seeks. r=jwwang

We only perform the last seek requested instead.
This commit is contained in:
Jean-Yves Avenard 2015-09-28 15:23:28 +10:00
Родитель 9323ac2f6a
Коммит 9396c59cd0
1 изменённых файлов: 10 добавлений и 1 удалений

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

@ -1411,7 +1411,9 @@ MediaFormatReader::Seek(int64_t aTime, int64_t aUnused)
nsRefPtr<SeekPromise> p = mSeekPromise.Ensure(__func__);
AttemptSeek();
RefPtr<nsIRunnable> task(
NS_NewRunnableMethod(this, &MediaFormatReader::AttemptSeek));
OwnerThread()->Dispatch(task.forget());
return p;
}
@ -1420,6 +1422,13 @@ void
MediaFormatReader::AttemptSeek()
{
MOZ_ASSERT(OnTaskQueue());
if (mPendingSeekTime.isNothing()) {
return;
}
// An internal seek may be pending due to Seek queueing multiple tasks calling
// AttemptSeek ; we can ignore those by resetting any pending demuxer's seek.
mAudio.mSeekRequest.DisconnectIfExists();
mVideo.mSeekRequest.DisconnectIfExists();
if (HasVideo()) {
DoVideoSeek();
} else if (HasAudio()) {