Bug 1205825 - part 2 - call Get*CachedData*Internal variants from MediaCacheStream::GetCachedRanges; r=roc

Each of GetNextCachedData and GetCachedDataEndInternal grab the monitor
on entrance, but GetCachedRanges has already grabbed the monitor for us.
We can call the *Internal variants instead, which assert that the
monitor is held.
This commit is contained in:
Nathan Froyd 2015-09-18 00:15:56 -04:00
parent ee09350fca
commit 63df15ccef

View File

@ -2461,13 +2461,13 @@ nsresult MediaCacheStream::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
// shrink while we're trying to loop over them.
NS_ASSERTION(mPinCount > 0, "Must be pinned");
int64_t startOffset = GetNextCachedData(0);
int64_t startOffset = GetNextCachedDataInternal(0);
while (startOffset >= 0) {
int64_t endOffset = GetCachedDataEnd(startOffset);
int64_t endOffset = GetCachedDataEndInternal(startOffset);
NS_ASSERTION(startOffset < endOffset, "Buffered range must end after its start");
// Bytes [startOffset..endOffset] are cached.
aRanges.AppendElement(MediaByteRange(startOffset, endOffset));
startOffset = GetNextCachedData(endOffset);
startOffset = GetNextCachedDataInternal(endOffset);
NS_ASSERTION(startOffset == -1 || startOffset > endOffset,
"Must have advanced to start of next range, or hit end of stream");
}