Bug 1138072 - Don't defer reading to a closed stream. r=roc

Other streams in the list bail out of the servicing loop if they're closed, so
we can wait indefinitely.
This commit is contained in:
Bobby Holley 2015-02-27 16:00:51 -08:00
parent e1d5cc2a9b
commit 903b695c08

View File

@ -1173,8 +1173,10 @@ MediaCache::Update()
actions.AppendElement(NONE);
MediaCacheStream* stream = mStreams[i];
if (stream->mClosed)
if (stream->mClosed) {
CACHE_LOG(PR_LOG_DEBUG, ("Stream %p closed", stream));
continue;
}
// Figure out where we should be reading from. It's the first
// uncached byte after the current mStreamOffset.
@ -1280,7 +1282,7 @@ MediaCache::Update()
for (uint32_t j = 0; j < i; ++j) {
MediaCacheStream* other = mStreams[j];
if (other->mResourceID == stream->mResourceID &&
!other->mClient->IsSuspended() &&
!other->mClosed && !other->mClient->IsSuspended() &&
other->mChannelOffset/BLOCK_SIZE == desiredOffset/BLOCK_SIZE) {
// This block is already going to be read by the other stream.
// So don't try to read it from this stream as well.