Bug 1416084. P2 - wake up readers when download is suspended.
It is possible that download is suspended after all bytes are received but
before OnStopRequest is notified. In that case, we will fail to wake up the
readers waiting to read the partial block and cause
bug 1412737 comment 30.
MozReview-Commit-ID: GUk4lXO6Upk
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -2301,16 +2301,21 @@ MediaCacheStream::NotifyClientSuspended(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"MediaCacheStream::NotifyClientSuspended", [client, this, aSuspended]() {
AutoLock lock(mMediaCache->Monitor());
if (!mClosed && mClientSuspended != aSuspended) {
mClientSuspended = aSuspended;
// mClientSuspended changes the decision of reading streams.
mMediaCache->QueueUpdate(lock);
UpdateDownloadStatistics(lock);
+ if (mClientSuspended) {
+ // Download is suspended. Wake up the readers that might be able to
+ // get data from the partial block.
+ lock.NotifyAll();
+ }
}
});
OwnerThread()->Dispatch(r.forget());
}
void
MediaCacheStream::NotifyResume()
{