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
--- 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;