Bug 604067 - Handle error codes from libvorbis in WebM reader. r=kinetik a=blocking2.0

This commit is contained in:
Chris Pearce 2010-10-17 08:57:45 +13:00
parent 84e276b818
commit ba5cd52aca
6 changed files with 12 additions and 9 deletions

View File

@ -1405,23 +1405,22 @@ void nsBuiltinDecoderStateMachine::LoadMetadata()
mDecoder->GetMonitor().AssertCurrentThreadIn();
LOG(PR_LOG_DEBUG, ("Loading Media Headers"));
nsresult res;
{
MonitorAutoExit exitMon(mDecoder->GetMonitor());
mReader->ReadMetadata();
res = mReader->ReadMetadata();
}
mDecoder->StartProgressUpdates();
const nsVideoInfo& info = mReader->GetInfo();
mGotDurationFromMetaData = (GetDuration() != -1);
if (!info.mHasVideo && !info.mHasAudio) {
if (NS_FAILED(res) || (!info.mHasVideo && !info.mHasAudio)) {
mState = DECODER_STATE_SHUTDOWN;
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::DecodeError);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
return;
}
mDecoder->StartProgressUpdates();
mGotDurationFromMetaData = (GetDuration() != -1);
}
void nsBuiltinDecoderStateMachine::StartBuffering()

View File

@ -190,6 +190,8 @@ _TEST_FILES += \
bug533822.ogg \
bug557094.ogv \
bug580982.webm \
bug603918.webm \
bug604067.webm \
chain.ogv \
dirac.ogg \
split.webm \

Binary file not shown.

Binary file not shown.

View File

@ -197,6 +197,8 @@ var gErrorTests = [
{ name:"bug504843.ogv", type:"video/ogg" },
{ name:"bug501279.ogg", type:"audio/ogg" },
{ name:"bug580982.webm", type:"video/webm" },
{ name:"bug603918.webm", type:"video/webm" },
{ name:"bug604067.webm", type:"video/webm" },
{ name:"bogus.duh", type:"bogus/duh" }
];

View File

@ -301,20 +301,20 @@ nsresult nsWebMReader::ReadMetadata()
r = vorbis_synthesis_headerin(&mVorbisInfo,
&mVorbisComment,
&opacket);
if (r < 0) {
if (r != 0) {
Cleanup();
return NS_ERROR_FAILURE;
}
}
r = vorbis_synthesis_init(&mVorbisDsp, &mVorbisInfo);
if (r < 0) {
if (r != 0) {
Cleanup();
return NS_ERROR_FAILURE;
}
r = vorbis_block_init(&mVorbisDsp, &mVorbisBlock);
if (r < 0) {
if (r != 0) {
Cleanup();
return NS_ERROR_FAILURE;
}