Don't defer reading to a closed stream

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:
trav90
2016-09-17 08:53:58 -05:00
committed by roytam1
parent e1b49f372d
commit cdfdcf4aee
+4 -2
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.