Bug 1126465 - Don't leave stale value in mPendingSeek when there's no audio track. r=mattwoodrow, a=sledru
authorBobby Holley <bobbyholley@gmail.com>
Thu, 29 Jan 2015 22:11:11 -0800
changeset 243641 ebd1573c5911
parent 243640 dbb452162854
child 243642 6e44bfd1e0f8
push id4421
push userryanvm@gmail.com
push date2015-02-02 19:52 +0000
treeherdermozilla-beta@08a02585bc60 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, sledru
bugs1126465
milestone36.0
Bug 1126465 - Don't leave stale value in mPendingSeek when there's no audio track. r=mattwoodrow, a=sledru
dom/media/mediasource/MediaSourceReader.cpp
--- a/dom/media/mediasource/MediaSourceReader.cpp
+++ b/dom/media/mediasource/MediaSourceReader.cpp
@@ -692,44 +692,45 @@ MediaSourceReader::CancelSeek()
   } else {
     MOZ_ASSERT(mSeekPromise.IsEmpty());
   }
 }
 
 void
 MediaSourceReader::OnVideoSeekCompleted(int64_t aTime)
 {
-  mPendingSeekTime = aTime;
   MOZ_ASSERT(mVideoIsSeeking);
   MOZ_ASSERT(!mAudioIsSeeking);
   mVideoIsSeeking = false;
 
   if (mAudioTrack) {
+    mPendingSeekTime = aTime;
     mAudioIsSeeking = true;
     SwitchAudioReader(mPendingSeekTime);
     mAudioReader->Seek(mPendingSeekTime, 0)
                 ->Then(GetTaskQueue(), __func__, this,
                        &MediaSourceReader::OnAudioSeekCompleted,
                        &MediaSourceReader::OnSeekFailed);
     MSE_DEBUG("MediaSourceReader(%p)::Seek audio reader=%p", this, mAudioReader.get());
     return;
   }
-  mSeekPromise.Resolve(mPendingSeekTime, __func__);
+  mPendingSeekTime = -1;
+  mSeekPromise.Resolve(aTime, __func__);
 }
 
 void
 MediaSourceReader::OnAudioSeekCompleted(int64_t aTime)
 {
   mPendingSeekTime = aTime;
   MOZ_ASSERT(mAudioIsSeeking);
   MOZ_ASSERT(!mVideoIsSeeking);
   mAudioIsSeeking = false;
 
-  mSeekPromise.Resolve(mPendingSeekTime, __func__);
   mPendingSeekTime = -1;
+  mSeekPromise.Resolve(aTime, __func__);
 }
 
 void
 MediaSourceReader::OnSeekFailed(nsresult aResult)
 {
   MOZ_ASSERT(mVideoIsSeeking || mAudioIsSeeking);
 
   if (mVideoIsSeeking) {