Bug 1368837 - MockMediaResource::GetCachedDataEnd should return the offset if out of range - r=cpearce
If the requested cached-data offset is out of range, we should just return the
same offset, as it signals that the actual cached range is 0 bytes, without
having to deal with -1.
MozReview-Commit-ID: D0rXO0S0mss
--- a/dom/media/gtest/MockMediaResource.cpp
+++ b/dom/media/gtest/MockMediaResource.cpp
@@ -99,17 +99,17 @@ MockMediaResource::GetNextCachedData(int
int64_t
MockMediaResource::GetCachedDataEnd(int64_t aOffset)
{
for (size_t i = 0; i < mRanges.Length(); i++) {
if (aOffset == mRanges[i].mStart) {
return mRanges[i].mEnd;
}
}
- return -1;
+ return aOffset;
}
nsresult
MockMediaResource::GetCachedRanges(MediaByteRangeSet& aRanges)
{
aRanges = mRanges;
return NS_OK;
}