diff --git a/content/media/nsBuiltinDecoderStateMachine.cpp b/content/media/nsBuiltinDecoderStateMachine.cpp index d0fa05f6fc41..fb91f8062d1d 100644 --- a/content/media/nsBuiltinDecoderStateMachine.cpp +++ b/content/media/nsBuiltinDecoderStateMachine.cpp @@ -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 event = NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::DecodeError); NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL); return; } + mDecoder->StartProgressUpdates(); + mGotDurationFromMetaData = (GetDuration() != -1); } void nsBuiltinDecoderStateMachine::StartBuffering() diff --git a/content/media/test/Makefile.in b/content/media/test/Makefile.in index 48d662c970ca..b18928ea78b1 100644 --- a/content/media/test/Makefile.in +++ b/content/media/test/Makefile.in @@ -190,6 +190,8 @@ _TEST_FILES += \ bug533822.ogg \ bug557094.ogv \ bug580982.webm \ + bug603918.webm \ + bug604067.webm \ chain.ogv \ dirac.ogg \ split.webm \ diff --git a/content/media/test/bug603918.webm b/content/media/test/bug603918.webm new file mode 100644 index 000000000000..c430e97f404b Binary files /dev/null and b/content/media/test/bug603918.webm differ diff --git a/content/media/test/bug604067.webm b/content/media/test/bug604067.webm new file mode 100644 index 000000000000..86bdfdc91f40 Binary files /dev/null and b/content/media/test/bug604067.webm differ diff --git a/content/media/test/manifest.js b/content/media/test/manifest.js index 6674383e97d7..f65b9259a33c 100644 --- a/content/media/test/manifest.js +++ b/content/media/test/manifest.js @@ -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" } ]; diff --git a/content/media/webm/nsWebMReader.cpp b/content/media/webm/nsWebMReader.cpp index 737970e357b5..49350a12af60 100644 --- a/content/media/webm/nsWebMReader.cpp +++ b/content/media/webm/nsWebMReader.cpp @@ -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; }