Bug 1375772. P1 - don't evict readahead blocks since it could be expensive or impossible (for non-seekable streams) to download them later. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 22 Jun 2017 15:59:22 +0800
changeset 599466 9b54ed88bb22a985f3f5fa48a9e19846ae7df5f7
parent 599465 4c67459c1306e7dee750ff542fdfe63bcc47d781
child 599467 5728fe56473a9a7aa6252e3ac5d85c0451863fac
push id65537
push userjwwang@mozilla.com
push dateFri, 23 Jun 2017 06:55:10 +0000
bugs1375772
milestone56.0a1
Bug 1375772. P1 - don't evict readahead blocks since it could be expensive or impossible (for non-seekable streams) to download them later. Note the downside of this change is when playback is paused, the cache size might stay overflowed when no other blocks can be evicted. However, this issue should be minor since the cache suspends streams when overflow is detected. So the cache won't 'overflow' too much in this sense. MozReview-Commit-ID: FR6eT6BZQFo
dom/media/MediaCache.cpp
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -856,21 +856,18 @@ MediaCache::FindReusableBlock(TimeStamp 
     if (stream->mPinCount > 0) {
       // No point in even looking at this stream's blocks
       continue;
     }
 
     AppendMostReusableBlock(&stream->mMetadataBlocks, &candidates, length);
     AppendMostReusableBlock(&stream->mPlayedBlocks, &candidates, length);
 
-    // Don't consider readahead blocks in non-seekable streams. If we
-    // remove the block we won't be able to seek back to read it later.
-    if (stream->mIsTransportSeekable) {
-      AppendMostReusableBlock(&stream->mReadaheadBlocks, &candidates, length);
-    }
+    // Don't consider readahead blocks since it could be expensive or
+    // impossible (for non-seekable streams) to download them later.
   }
 
   TimeDuration latestUse;
   int32_t latestUseBlock = -1;
   for (uint32_t i = 0; i < candidates.Length(); ++i) {
     TimeDuration nextUse = PredictNextUse(aNow, candidates[i]);
     if (nextUse > latestUse) {
       latestUse = nextUse;