Bug 1322087. Part 1 - move |if (!mFirstFrameLoaded)| up to save some duplicate checks. r=cpearce

MozReview-Commit-ID: 77duxxtEAQP

--HG--
extra : rebase_source : 19810302dff31bdc02f12d79d1518ad9793fabc0
extra : source : bd86f44a0c38b8d60fafd8bdb26bdb786662c90f
This commit is contained in:
JW Wang 2016-12-06 15:54:51 -10:00
Родитель c2c3085e8a
Коммит 8e49c2b21d
1 изменённых файлов: 8 добавлений и 12 удалений

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

@ -5323,9 +5323,13 @@ HTMLMediaElement::UpdateReadyStateInternal()
return;
}
if (mDownloadSuspendedByCache &&
mDecoder && !mDecoder->IsEnded() &&
mFirstFrameLoaded) {
if (!mFirstFrameLoaded) {
// We haven't yet loaded the first frame, making us unable to determine
// if we have enough valid data at the present stage.
return;
}
if (mDownloadSuspendedByCache && mDecoder && !mDecoder->IsEnded()) {
// The decoder has signaled that the download has been suspended by the
// media cache. So move readyState into HAVE_ENOUGH_DATA, in case there's
// script waiting for a "canplaythrough" event; without this forced
@ -5344,15 +5348,7 @@ HTMLMediaElement::UpdateReadyStateInternal()
if (nextFrameStatus != MediaDecoderOwner::NEXT_FRAME_AVAILABLE) {
LOG(LogLevel::Debug, ("MediaElement %p UpdateReadyStateInternal() "
"Next frame not available", this));
if (mFirstFrameLoaded) {
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
}
return;
}
if (!mFirstFrameLoaded) {
// We haven't yet loaded the first frame, making us unable to determine
// if we have enough valid data at the present stage.
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
return;
}