Bug 517818. Wave decoder should not look beyond the Wave data area to see if we have a 'next frame' to play. r=kinetik

--HG--
extra : rebase_source : 9964f0fe36d35745354f5723b5d82b1fc18520d6
This commit is contained in:
Robert O'Callahan 2009-09-30 07:32:41 +10:00
parent f98d7a8ba5
commit 07ec9a4619
2 changed files with 7 additions and 1 deletions

View File

@ -46,6 +46,7 @@ function startTests() {
ok(Math.abs(v.currentTime - test.duration) < 0.1,
test.name + " current time at end: " + v.currentTime);
}
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.ended, test.name + " checking playback has ended");
--testsWaiting;
if (testsWaiting == 0) {

View File

@ -461,7 +461,12 @@ nsWaveStateMachine::GetNextFrameStatus()
nsAutoMonitor monitor(mMonitor);
if (mState == STATE_BUFFERING)
return nsHTMLMediaElement::NEXT_FRAME_UNAVAILABLE_BUFFERING;
if (mPlaybackPosition < mStream->GetCachedDataEnd(mPlaybackPosition))
// If mMetadataValid is false then we can't call GetDataLength because
// we haven't got the length from the Wave header yet. But we know that
// if we haven't read the metadata then we don't have playable data.
if (mMetadataValid &&
mPlaybackPosition < mStream->GetCachedDataEnd(mPlaybackPosition) &&
mPlaybackPosition < mWavePCMOffset + GetDataLength())
return nsHTMLMediaElement::NEXT_FRAME_AVAILABLE;
return nsHTMLMediaElement::NEXT_FRAME_UNAVAILABLE;
}