Bug 1171311: P11. Only perform fuzz search on the interval's start. r=mattwoodrow a=kwierso

This commit is contained in:
Jean-Yves Avenard 2015-06-12 09:26:58 +10:00
parent 3533b2f179
commit 97fc04bbf8
2 changed files with 21 additions and 1 deletions

View File

@ -129,6 +129,11 @@ public:
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) &&
@ -140,6 +145,12 @@ public:
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) &&
@ -560,6 +571,15 @@ public:
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)
{

View File

@ -400,7 +400,7 @@ MediaSourceTrackDemuxer::GetSample(DemuxerFailureReason& aFailure)
// First demux, get first sample time.
mNextSampleTime = ranges.GetStart();
}
if (!ranges.Contains(mNextSampleTime)) {
if (!ranges.ContainsWithStrictEnd(mNextSampleTime)) {
aFailure = DemuxerFailureReason::WAITING_FOR_DATA;
return nullptr;
}