Bug 1413858 - Resume() needs to reset mPendingSeekOffset before calling Seek(). r=gerald
authorJW Wang <jwwang@mozilla.com>
Thu, 02 Nov 2017 20:25:57 +0800
changeset 389970 3aba4a72b8a524e137d45ae2e9545e6344fa584d
parent 389969 92ff0c88e94d176ff9615abe61322413b7f38e55
child 389971 e6d86b7284bae701700b9d300ee1476ebe5f3eed
push id96957
push usernbeleuzu@mozilla.com
push dateFri, 03 Nov 2017 10:23:12 +0000
treeherdermozilla-inbound@c17190dfd88b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1413858
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1413858 - Resume() needs to reset mPendingSeekOffset before calling Seek(). r=gerald 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.
       }
     }
   }
 }