Bug 1127122 - Make ResourceQueue::Evict treat aSizeToEvict as relative to the start of the data instead of 0. r=cajbir, r=jya, a=gavin
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 29 Jan 2015 23:34:18 +1300
changeset 249488 ebd697fe1d5270ddc1d138c927e3d1fb9464a35c
parent 249487 282e97a8f089e29dee5260a7c4fb43def4fbe734
child 249489 48a0df1f255509ce7482c4eb74bd9ee04344285b
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir, jya, gavin
bugs1127122
milestone37.0a2
Bug 1127122 - Make ResourceQueue::Evict treat aSizeToEvict as relative to the start of the data instead of 0. r=cajbir, r=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);