Bug 1296453: [MSE] P1. Fix eviction. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 23 Aug 2016 17:18:22 +1200
changeset 404300 04724ee936b4a222753bd24a56424d7789186c7e
parent 404125 34f08be263dca2aac3d3b129112028b8ea60569c
child 404301 abd36882f98df21d708151c1f12ebdd6a7887beb
child 404302 b975fd024f32161c3320c061a62eb90c81f3738b
push id27160
push userbmo:jyavenard@mozilla.com
push dateTue, 23 Aug 2016 05:41:40 +0000
reviewersgerald
bugs1296453
milestone51.0a1
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
dom/media/mediasource/SourceBufferResource.cpp
--- 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()
 {