Bug 1278228 - handle VideoOnly seek as an accurate seek; r?jwwang
MozReview-Commit-ID: DsQQB8YX2jm
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1162,16 +1162,23 @@ MediaDecoderStateMachine::SetDormant(boo
DECODER_LOG("SetDormant=%d", aDormant);
if (aDormant) {
if (mState == DECODER_STATE_SEEKING) {
if (mQueuedSeek.Exists()) {
// Keep latest seek target
} else if (mSeekTask && mSeekTask->Exists()) {
+ // Because both audio and video decoders are going to be reset in this
+ // method later, we treat a VideoOnly seek task as a normal Accurate
+ // seek task so that while it is resumed, both audio and video playback
+ // are handled.
+ if (mSeekTask->GetSeekJob().mTarget.IsVideoOnly()) {
+ mSeekTask->GetSeekJob().mTarget.SetType(SeekTarget::Accurate);
+ }
mQueuedSeek = Move(mSeekTask->GetSeekJob());
mSeekTaskRequest.DisconnectIfExists();
} else {
mQueuedSeek.mTarget = SeekTarget(mCurrentPosition,
SeekTarget::Accurate,
MediaDecoderEventVisibility::Suppressed);
// XXXbholley - Nobody is listening to this promise. Do we need to pass it
// back to MediaDecoder when we come out of dormant?
@@ -1639,19 +1646,16 @@ MediaDecoderStateMachine::InitiateSeek(S
mSeekTask = new AccurateSeekTask(mDecoderID, OwnerThread(),
mReader.get(), Move(aSeekJob),
mInfo, Duration(), GetMediaTime());
} else if (aSeekJob.mTarget.IsNextFrame()) {
mSeekTask = new NextFrameSeekTask(mDecoderID, OwnerThread(), mReader.get(),
Move(aSeekJob), mInfo, Duration(),
GetMediaTime(), AudioQueue(), VideoQueue());
} else {
- // Use MOZ_DIAGNOSTIC_ASSERT here to test if a "VideoOnly" seek task could
- // reach here, may come from a dormant state. Once we confirm it, we could
- // than handle it.
MOZ_DIAGNOSTIC_ASSERT(false, "Cannot handle this seek task.");
}
// Stop playback now to ensure that while we're outside the monitor
// dispatching SeekingStarted, playback doesn't advance and mess with
// mCurrentPosition that we've setting to seekTime here.
StopPlayback();
UpdatePlaybackPositionInternal(mSeekTask->GetSeekJob().mTarget.GetTime().ToMicroseconds());