Bug 1127122 - Make ResourceQueue::Evict treat aSizeToEvict as relative to the start of the data instead of 0. r=cajbir,jya a=gavin
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 29 Jan 2015 23:34:18 +1300
changeset 243597 ef10110ab600
parent 243596 992f411762d0
child 243598 914ded138557
child 243599 4a36fd52ab9f
push id4408
push userrgiles@mozilla.com
push date2015-01-30 00:43 +0000
treeherdermozilla-beta@ef10110ab600 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir, jya, gavin
bugs1127122
milestone36.0
Bug 1127122 - Make ResourceQueue::Evict treat aSizeToEvict as relative to the start of the data instead of 0. r=cajbir,jya a=gavin
dom/media/mediasource/ResourceQueue.h
--- a/dom/media/mediasource/ResourceQueue.h
+++ b/dom/media/mediasource/ResourceQueue.h
@@ -103,17 +103,17 @@ public:
     Push(new ResourceItem(aData));
   }
 
   // Tries to evict at least aSizeToEvict from the queue up until
   // aOffset. Returns amount evicted.
   uint32_t Evict(uint64_t aOffset, uint32_t aSizeToEvict) {
     SBR_DEBUG("ResourceQueue(%p)::Evict(aOffset=%llu, aSizeToEvict=%u)",
               this, aOffset, aSizeToEvict);
-    return EvictBefore(std::min(aOffset, (uint64_t)aSizeToEvict));
+    return EvictBefore(std::min(aOffset, mOffset + (uint64_t)aSizeToEvict));
   }
 
   uint32_t EvictBefore(uint64_t aOffset) {
     SBR_DEBUG("ResourceQueue(%p)::EvictBefore(%llu)", this, aOffset);
     uint32_t evicted = 0;
     while (ResourceItem* item = ResourceAt(0)) {
       SBR_DEBUG("ResourceQueue(%p)::EvictBefore item=%p length=%d offset=%llu",
                 this, item, item->mData->Length(), mOffset);