Bug 1171311: P11. Only perform fuzz search on the interval's start. r=mattwoodrow a=kwierso
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 12 Jun 2015 09:26:58 +1000
changeset 248382 ff2657655cdecbd40a164480e8f8fa511b48600a
parent 248381 ea7919145d65acc4cf79c1be6c7d9a119cac775e
child 248480 65540960b133516eeff9fa77b53bca5f7ebd75e4
push id60958
push userjyavenard@mozilla.com
push dateFri, 12 Jun 2015 01:08:55 +0000
treeherdermozilla-inbound@ff2657655cde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, kwierso
bugs1171311
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1171311: P11. Only perform fuzz search on the interval's start. r=mattwoodrow a=kwierso
dom/media/Intervals.h
dom/media/mediasource/MediaSourceDemuxer.cpp
--- a/dom/media/Intervals.h
+++ b/dom/media/Intervals.h
@@ -124,27 +124,38 @@ public:
     return mStart - mFuzz <= aX && aX < mEnd + mFuzz;
   }
 
   bool ContainsStrict(const T& aX) const
   {
     return mStart <= aX && aX < mEnd;
   }
 
+  bool ContainsWithStrictEnd(const T& aX) const
+  {
+    return mStart - mFuzz <= aX && aX < mEnd;
+  }
+
   bool Contains(const SelfType& aOther) const
   {
     return (mStart - mFuzz <= aOther.mStart + aOther.mFuzz) &&
       (aOther.mEnd - aOther.mFuzz <= mEnd + mFuzz);
   }
 
   bool ContainsStrict(const SelfType& aOther) const
   {
     return mStart <= aOther.mStart && aOther.mEnd <= mEnd;
   }
 
+  bool ContainsWithStrictEnd(const SelfType& aOther) const
+  {
+    return (mStart - mFuzz <= aOther.mStart + aOther.mFuzz) &&
+      aOther.mEnd <= mEnd;
+  }
+
   bool Intersects(const SelfType& aOther) const
   {
     return (mStart - mFuzz < aOther.mEnd + aOther.mFuzz) &&
       (aOther.mStart - aOther.mFuzz < mEnd + mFuzz);
   }
 
   // Same as Intersects, but including the boundaries.
   bool Touches(const SelfType& aOther) const
@@ -555,16 +566,25 @@ public:
     for (const auto& interval : mIntervals) {
       if (interval.ContainsStrict(aX)) {
         return true;
       }
     }
     return false;
   }
 
+  bool ContainsWithStrictEnd(const T& aX) const {
+    for (const auto& interval : mIntervals) {
+      if (interval.ContainsWithStrictEnd(aX)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   // Shift all values by aOffset.
   SelfType& Shift(const T& aOffset)
   {
     for (auto& interval : mIntervals) {
       interval.mStart = interval.mStart + aOffset;
       interval.mEnd = interval.mEnd + aOffset;
     }
     return *this;
--- a/dom/media/mediasource/MediaSourceDemuxer.cpp
+++ b/dom/media/mediasource/MediaSourceDemuxer.cpp
@@ -395,17 +395,17 @@ MediaSourceTrackDemuxer::GetSample(Demux
       aFailure = DemuxerFailureReason::WAITING_FOR_DATA;
     }
     return nullptr;
   }
   if (mNextSampleTime == TimeUnit()) {
     // First demux, get first sample time.
     mNextSampleTime = ranges.GetStart();
   }
-  if (!ranges.Contains(mNextSampleTime)) {
+  if (!ranges.ContainsWithStrictEnd(mNextSampleTime)) {
     aFailure = DemuxerFailureReason::WAITING_FOR_DATA;
     return nullptr;
   }
 
   if (mNextSampleIndex) {
     const nsRefPtr<MediaRawData>& sample = track[mNextSampleIndex];
     nsRefPtr<MediaRawData> p = sample->Clone();
     if (!p) {