Bug 1426056. P4 - fix a case where we don't reopen the channel. draft
authorJW Wang <jwwang@mozilla.com>
Tue, 19 Dec 2017 14:35:25 +0800
changeset 713283 ccf6b9856c6f1f6f3241a65c1c8bdcce925903d8
parent 713282 37ec9c60fe6311b1ed74a0e6f65979548df1d925
child 713284 40ca773d004cf588be9e76a014f83aa7b8687b02
push id93611
push userjwwang@mozilla.com
push dateWed, 20 Dec 2017 02:48:06 +0000
bugs1426056
milestone59.0a1
Bug 1426056. P4 - fix a case where we don't reopen the channel. In MediaCacheStream::NotifyResume(), it will not reopen the channel if |mChannelOffset==mStreamLength && 0 <= mSeekTarget < mStreamLength| while we should. MozReview-Commit-ID: 2knkgy6FEVw
dom/media/MediaCache.cpp
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -2309,18 +2309,18 @@ MediaCacheStream::NotifyResume()
     "MediaCacheStream::NotifyResume",
     [ this, client = RefPtr<ChannelMediaResource>(mClient) ]() {
       AutoLock lock(mMediaCache->Monitor());
       if (mClosed) {
         return;
       }
       // Don't resume download if we are already at the end of the stream for
       // seek will fail and be wasted anyway.
-      if (mStreamLength < 0 || mChannelOffset < mStreamLength) {
-        int64_t offset = mSeekTarget != -1 ? mSeekTarget : mChannelOffset;
+      int64_t offset = mSeekTarget != -1 ? mSeekTarget : mChannelOffset;
+      if (mStreamLength < 0 || offset < mStreamLength) {
         mClient->CacheClientSeek(offset, false);
         // DownloadResumed() will be notified when a new channel is opened.
       }
       // The channel remains dead. If we want to read some other data in the
       // future, CacheClientSeek() will be called to reopen the channel.
     });
   OwnerThread()->Dispatch(r.forget());
 }