Bug 1337276 - discard the audio request so we won't add audio samples to a finished queue. draft
authorJW Wang <jwwang@mozilla.com>
Tue, 07 Feb 2017 14:33:52 +0800
changeset 479763 2c0ffff616a20fd25ded01a4c9ebcd40fb2ef0c9
parent 479414 5dce0af5b18c671244f5d22d6411e20263e68044
child 544769 0c54db521a09105db9580aebc2eedcda9bee32cc
push id44346
push userjwwang@mozilla.com
push dateTue, 07 Feb 2017 06:35:50 +0000
bugs1337276
milestone54.0a1
Bug 1337276 - discard the audio request so we won't add audio samples to a finished queue. MozReview-Commit-ID: JN9QwzfCaVK
dom/media/MediaDecoderStateMachine.cpp
--- 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__);