Bug 481488. Report HAVE_ENOUGH_DATA when we load the entire file before we even have a decoded frame. r=doublec,sr=roc

--HG--
extra : rebase_source : 45c5ebfcab187ae1b04cbe489e113781f61d43b8
This commit is contained in:
Chris Pearce 2009-03-30 13:55:04 +13:00
parent 8caa418ee5
commit ae111168f6

View File

@ -1229,7 +1229,11 @@ void nsHTMLMediaElement::UpdateReadyStateForData(NextFrameStatus aNextFrame)
return;
}
if (aNextFrame != NEXT_FRAME_AVAILABLE && !mDecoder->IsEnded()) {
nsMediaDecoder::Statistics stats = mDecoder->GetStatistics();
if (aNextFrame != NEXT_FRAME_AVAILABLE &&
!mDecoder->IsEnded() &&
stats.mDownloadPosition < stats.mTotalBytes) {
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
if (!mWaitingFired && aNextFrame == NEXT_FRAME_UNAVAILABLE_BUFFERING) {
DispatchAsyncSimpleEvent(NS_LITERAL_STRING("waiting"));
@ -1239,7 +1243,6 @@ void nsHTMLMediaElement::UpdateReadyStateForData(NextFrameStatus aNextFrame)
}
// Now see if we should set HAVE_ENOUGH_DATA
nsMediaDecoder::Statistics stats = mDecoder->GetStatistics();
if (stats.mTotalBytes < 0 || stats.mTotalBytes == stats.mDownloadPosition) {
// If it's something we don't know the size of, then we can't
// make an estimate, so let's just go straight to HAVE_ENOUGH_DATA,