Bug 1136984 - Use correct units for comparing timestamps in TrackBuffer::RangeRemoval. r=jya a=lmandel
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 27 Feb 2015 12:07:05 +1300
changeset 250139 09b2c7fed10f
parent 250138 5a7e83327249
child 250140 c16968de534c
push id4512
push userrgiles@mozilla.com
push date2015-03-02 18:00 +0000
treeherdermozilla-beta@09b2c7fed10f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, lmandel
bugs1136984
milestone37.0
Bug 1136984 - Use correct units for comparing timestamps in TrackBuffer::RangeRemoval. r=jya a=lmandel
dom/media/mediasource/TrackBuffer.cpp
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -1000,17 +1000,17 @@ TrackBuffer::RangeRemoval(int64_t aStart
   nsTArray<SourceBufferDecoder*> decoders;
   decoders.AppendElements(mInitializedDecoders);
 
   if (aStart <= bufferedStart && aEnd < bufferedEnd) {
     // Evict data from beginning.
     for (size_t i = 0; i < decoders.Length(); ++i) {
       nsRefPtr<dom::TimeRanges> buffered = new dom::TimeRanges();
       decoders[i]->GetBuffered(buffered);
-      if (buffered->GetEndTime() < aEnd) {
+      if (int64_t(buffered->GetEndTime() * USECS_PER_S) < aEnd) {
         // Can be fully removed.
         MSE_DEBUG("remove all bufferedEnd=%f time=%f, size=%lld",
                   buffered->GetEndTime(), time,
                   decoders[i]->GetResource()->GetSize());
         decoders[i]->GetResource()->EvictAll();
       } else {
         int64_t offset = decoders[i]->ConvertToByteOffset(aEnd);
         MSE_DEBUG("removing some bufferedEnd=%f offset=%lld size=%lld",
@@ -1019,17 +1019,17 @@ TrackBuffer::RangeRemoval(int64_t aStart
         if (offset > 0) {
           decoders[i]->GetResource()->EvictData(offset, offset);
         }
       }
     }
   } else {
     // Only trimming existing buffers.
     for (size_t i = 0; i < decoders.Length(); ++i) {
-      if (aStart <= buffered->GetStartTime()) {
+      if (aStart <= int64_t(buffered->GetStartTime() * USECS_PER_S)) {
         // It will be entirely emptied, can clear all data.
         decoders[i]->GetResource()->EvictAll();
       } else {
         decoders[i]->Trim(aStart);
       }
     }
   }