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
--- a/dom/media/mediasource/SourceBufferResource.cpp
+++ b/dom/media/mediasource/SourceBufferResource.cpp
@@ -149,20 +149,19 @@ SourceBufferResource::EvictData(uint64_t
return result;
}
void
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();
}
uint32_t
SourceBufferResource::EvictAll()
{