Bug 1417305. P3 - treat NS_BASE_STREAM_CLOSED as success. r=bechen,gerald

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

--HG--
extra : rebase_source : b9168704aa618eca553d96770e3256aadcc4b925
This commit is contained in:
JW Wang 2017-11-15 11:24:22 +08:00
Родитель 15d26ae3e8
Коммит 819392126d
1 изменённых файлов: 6 добавлений и 10 удалений

Просмотреть файл

@ -295,21 +295,17 @@ ChannelMediaDecoder::NotifyDownloadEnded(nsresult aStatus)
LOG("NotifyDownloadEnded, status=%" PRIx32, static_cast<uint32_t>(aStatus)); LOG("NotifyDownloadEnded, status=%" PRIx32, static_cast<uint32_t>(aStatus));
MediaDecoderOwner* owner = GetOwner(); MediaDecoderOwner* owner = GetOwner();
if (aStatus == NS_BINDING_ABORTED) { if (NS_SUCCEEDED(aStatus) || aStatus == NS_BASE_STREAM_CLOSED) {
// Download has been cancelled by user.
owner->LoadAborted();
return;
}
UpdatePlaybackRate(); UpdatePlaybackRate();
if (NS_SUCCEEDED(aStatus)) {
owner->DownloadSuspended(); owner->DownloadSuspended();
// NotifySuspendedStatusChanged will tell the element that download // NotifySuspendedStatusChanged will tell the element that download
// has been suspended "by the cache", which is true since we never // has been suspended "by the cache", which is true since we never
// download anything. The element can then transition to HAVE_ENOUGH_DATA. // download anything. The element can then transition to HAVE_ENOUGH_DATA.
owner->NotifySuspendedByCache(true); 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(); NetworkError();
} }
} }