Bug 1337276 - discard the audio request so we won't add audio samples to a finished queue.
MozReview-Commit-ID: JN9QwzfCaVK
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2313,16 +2313,21 @@ SeekingState::SeekCompleted()
AudioQueue().Finish();
VideoQueue().Finish();
// We won't start MediaSink when paused. m{Audio,Video}Completed will
// remain false and 'playbackEnded' won't be notified. Therefore we
// need to set these flags explicitly when seeking to the end.
mMaster->mAudioCompleted = true;
mMaster->mVideoCompleted = true;
+
+ // There might still be a pending audio request when doing video-only or
+ // next-frame seek. Discard it so we won't break the invariants of the
+ // COMPLETED state by adding audio samples to a finished queue.
+ mMaster->mAudioDataRequest.DisconnectIfExists();
}
// Cache mTarget for mSeekJob.Resolve() below will reset it.
SeekTarget target = mSeekJob.mTarget.ref();
// We want to resolve the seek request prior finishing the first frame
// to ensure that the seeked event is fired prior loadeded.
mSeekJob.Resolve(__func__);