Bug 1413858 - Resume() needs to reset mPendingSeekOffset before calling Seek(). draft
authorJW Wang <jwwang@mozilla.com>
Thu, 02 Nov 2017 20:25:57 +0800
changeset 692041 43a6bf1323180a1071b8704d33c91e4c4516e4b1
parent 691808 a0334f789772302ba5cfb6fd61290408842c7432
child 692092 9fd3cdc17138ce87bd2f67d93a5f915ccda12785
child 692397 90aaf942dfbfdff98ef3df412ed49141f3f50e55
push id87374
push userjwwang@mozilla.com
push dateThu, 02 Nov 2017 12:26:49 +0000
bugs1413858
milestone58.0a1
Bug 1413858 - Resume() needs to reset mPendingSeekOffset before calling Seek(). MozReview-Commit-ID: GbZ3SvSTMvR
dom/media/ChannelMediaResource.cpp
--- a/dom/media/ChannelMediaResource.cpp
+++ b/dom/media/ChannelMediaResource.cpp
@@ -739,19 +739,20 @@ ChannelMediaResource::Resume()
       // If mOffset is at the end of the stream, then we shouldn't try to
       // seek to it. The seek will fail and be wasted anyway. We can leave
       // the channel dead; if the media cache wants to read some other data
       // in the future, it will call CacheClientSeek itself which will reopen the
       // channel.
       if (totalLength < 0 || GetOffset() < totalLength) {
         // There is (or may be) data to read, so start reading it.
         // Need to recreate the channel.
-        Seek(mPendingSeekOffset != -1 ? mPendingSeekOffset : GetOffset(),
-             false);
+        int64_t offset =
+          mPendingSeekOffset != -1 ? mPendingSeekOffset : GetOffset();
         mPendingSeekOffset = -1;
+        Seek(offset, false);
         element->DownloadResumed();
       } else {
         // The channel remains dead. Do not notify DownloadResumed() which
         // will leave the media element in NETWORK_LOADING state.
       }
     }
   }
 }