Bug 1427666 - MediaCacheStream::InitAsCloneInternal() should notify the client that new data is available. draft
authorJW Wang <jwwang@mozilla.com>
Wed, 03 Jan 2018 10:33:11 +0800
changeset 715193 2deb61fab45c861a81c48cca946ecb9f8295134d
parent 715192 7fa135516eb4fb5efee5d63688c5c2d8efb62af5
child 715194 eb3c9895e50cfb31bc0403a9e44af069e2f1f1ec
push id94088
push userjwwang@mozilla.com
push dateWed, 03 Jan 2018 02:34:17 +0000
bugs1427666
milestone59.0a1
Bug 1427666 - MediaCacheStream::InitAsCloneInternal() should notify the client that new data is available. We should call ChannelMediaResource::CacheClientNotifyDataReceived() no matter new data is coming from the channel or copied from the original cache stream so the decoder has a chance to compute 'canplaythrough' and buffer ranges. MozReview-Commit-ID: I4cLow2VzJg
dom/media/MediaCache.cpp
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -2911,16 +2911,20 @@ MediaCacheStream::InitAsCloneInternal(Me
   mResourceID = aOriginal->mResourceID;
 
   // Grab cache blocks from aOriginal as readahead blocks for our stream
   mStreamLength = aOriginal->mStreamLength;
   mIsTransportSeekable = aOriginal->mIsTransportSeekable;
   mDownloadStatistics = aOriginal->mDownloadStatistics;
   mDownloadStatistics.Stop();
 
+  // Notify the client that we have new data so the decoder has a chance to
+  // compute 'canplaythrough' and buffer ranges.
+  mClient->CacheClientNotifyDataReceived();
+
   if (aOriginal->mDidNotifyDataEnded &&
       NS_SUCCEEDED(aOriginal->mNotifyDataEndedStatus)) {
     mNotifyDataEndedStatus = aOriginal->mNotifyDataEndedStatus;
     mDidNotifyDataEnded = true;
     mClient->CacheClientNotifyDataEnded(mNotifyDataEndedStatus);
   }
 
   for (uint32_t i = 0; i < aOriginal->mBlocks.Length(); ++i) {