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

The MP4 demuxer returns INT64_MAX when all data can be safely evicted
from the MediaResource.
Additionally, the MP4Demuxer will read the MediaResource using
CacheReadAt.

Eviction in the SourceBufferResource had a safeguard to ensure we would
never evict data we hadn't read yet. This was done by keeping the
position of the last data read in the mOffset member. CacheReadAt
however doesn't update mOffset.

As a result, no data was ever removed from the input buffer when using
MP4.

MozReview-Commit-ID: 2tAWzpMlOjG

--HG--
extra : rebase_source : bec585ca46e7fd0665c00bce525aaacede1b3897
This commit is contained in:
Jean-Yves Avenard 2016-08-23 17:18:22 +12:00
Родитель a63c848d60
Коммит 8e46c367ed
1 изменённых файлов: 3 добавлений и 4 удалений

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

@ -154,10 +154,9 @@ SourceBufferResource::EvictBefore(uint64_t aOffset, ErrorResult& aRv)
{
SBR_DEBUG("EvictBefore(aOffset=%llu)", aOffset);
ReentrantMonitorAutoEnter mon(mMonitor);
// If aOffset is past the current playback offset we don't evict.
if (aOffset < mOffset) {
mInputBuffer.EvictBefore(aOffset, aRv);
}
mInputBuffer.EvictBefore(aOffset, aRv);
// Wake up any waiting threads in case a ReadInternal call
// is now invalid.
mon.NotifyAll();