Bug 1259916: [MSE] P1. Fix eviction. r=gerald

Bug 1216460 introduced a regression which would cause to always evict from both ends of the current track buffer.

MozReview-Commit-ID: 4f01tNQ2KU8

--HG--
extra : rebase_source : 7da96fc1cbca03d60705fce681ee9259dd81d173
This commit is contained in:
Jean-Yves Avenard 2016-03-28 00:41:31 +11:00
Родитель 8ced3681df
Коммит c7c99753a2
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -475,6 +475,8 @@ TrackBuffersManager::DoEvictData(const TimeUnit& aPlaybackTime,
partialEvict += frame->ComputedSizeOfIncludingThis(); partialEvict += frame->ComputedSizeOfIncludingThis();
} }
const int64_t finalSize = mSizeSourceBuffer - aSizeToEvict;
if (lastKeyFrameIndex > 0) { if (lastKeyFrameIndex > 0) {
MSE_DEBUG("Step1. Evicting %lld bytes prior currentTime", MSE_DEBUG("Step1. Evicting %lld bytes prior currentTime",
aSizeToEvict - toEvict); aSizeToEvict - toEvict);
@ -483,8 +485,7 @@ TrackBuffersManager::DoEvictData(const TimeUnit& aPlaybackTime,
TimeUnit::FromMicroseconds(buffer[lastKeyFrameIndex]->mTime - 1))); TimeUnit::FromMicroseconds(buffer[lastKeyFrameIndex]->mTime - 1)));
} }
const int64_t finalSize = mSizeSourceBuffer - aSizeToEvict; if (mSizeSourceBuffer <= finalSize) {
if (mSizeSourceBuffer <= finalSize || !buffer.Length()) {
return; return;
} }