Bug 1417305. P3 - treat NS_BASE_STREAM_CLOSED as success.
Since we don't want to treat NS_BASE_STREAM_CLOSED as abort or error, let's just
treat it as success to simplify the call flow.
MozReview-Commit-ID: 1Fubaq6lfAq
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -290,31 +290,27 @@ ChannelMediaDecoder::NotifyDownloadEnded
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
AbstractThread::AutoEnter context(AbstractMainThread());
LOG("NotifyDownloadEnded, status=%" PRIx32, static_cast<uint32_t>(aStatus));
MediaDecoderOwner* owner = GetOwner();
- if (aStatus == NS_BINDING_ABORTED) {
- // Download has been cancelled by user.
- owner->LoadAborted();
- return;
- }
-
- UpdatePlaybackRate();
-
- if (NS_SUCCEEDED(aStatus)) {
+ if (NS_SUCCEEDED(aStatus) || aStatus == NS_BASE_STREAM_CLOSED) {
+ UpdatePlaybackRate();
owner->DownloadSuspended();
// NotifySuspendedStatusChanged will tell the element that download
// has been suspended "by the cache", which is true since we never
// download anything. The element can then transition to HAVE_ENOUGH_DATA.
owner->NotifySuspendedByCache(true);
- } else if (aStatus != NS_BASE_STREAM_CLOSED) {
+ } else if (aStatus == NS_BINDING_ABORTED) {
+ // Download has been cancelled by user.
+ owner->LoadAborted();
+ } else {
NetworkError();
}
}
void
ChannelMediaDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
{
MOZ_ASSERT(NS_IsMainThread());