Bug 1391666 - P3. Change to HAVE_ENOUGH_DATA when possible. r=cpearce

In bug 1312886, we made sure that readyState would never become HAVE_ENOUGH_DATA if we were waiting for a key.
However, this is in effect useless as the next call to ChangeReadyState would have reset mWaitingForKey.

In practice, it only meant that we delayed the change from HAVE_FUTURE_DATA to HAVE_ENOUGH_DATA until the next call to UpdateReadyState.

MozReview-Commit-ID: 2wnMeN8xxCS
This commit is contained in:
Jean-Yves Avenard
2017-08-18 21:00:08 +02:00
parent 459d4b6a28
commit c377660932

View File

@@ -5846,6 +5846,12 @@ HTMLMediaElement::UpdateReadyStateInternal()
return;
}
if (!mPaused || mAutoplaying) {
// We only want to reset mWaitingForKey if we have played all decoded data
// or if we haven't played anything yet.
mWaitingForKey = NOT_WAITING_FOR_KEY;
}
// Now see if we should set HAVE_ENOUGH_DATA.
// If it's something we don't know the size of, then we can't
// make a real estimate, so we go straight to HAVE_ENOUGH_DATA once
@@ -5854,7 +5860,7 @@ HTMLMediaElement::UpdateReadyStateInternal()
// autoplay elements for live streams will never play. Otherwise we
// move to HAVE_ENOUGH_DATA if we can play through the entire media
// without stopping to buffer.
if (mWaitingForKey == NOT_WAITING_FOR_KEY && mDecoder->CanPlayThrough()) {
if (mDecoder->CanPlayThrough()) {
LOG(LogLevel::Debug, ("MediaElement %p UpdateReadyStateInternal() "
"Decoder can play through", this));
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA);
@@ -5923,11 +5929,6 @@ void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState)
}
}
if (mReadyState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
(!mPaused || mAutoplaying)) {
mWaitingForKey = NOT_WAITING_FOR_KEY;
}
CheckAutoplayDataReady();
if (oldState < nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA &&