Bug 675747 - Handle multiple bos pages in a single ogg bitstream. r=doublec

This commit is contained in:
Chris Pearce 2011-08-05 08:44:24 +12:00
parent 80a5672ebf
commit f288cf29c0
4 changed files with 12 additions and 13 deletions

View File

@ -194,14 +194,17 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
int serial = ogg_page_serialno(&page);
nsOggCodecState* codecState = 0;
if (ogg_page_bos(&page)) {
NS_ASSERTION(!readAllBOS, "We shouldn't encounter another BOS page");
if (!ogg_page_bos(&page)) {
// We've encountered a non Beginning Of Stream page. No more BOS pages
// can follow in this Ogg segment, so there will be no other bitstreams
// in the Ogg (unless it's invalid).
readAllBOS = PR_TRUE;
} else if (!mCodecStates.Get(serial, nsnull)) {
// We've not encountered a stream with this serial number before. Create
// an nsOggCodecState to demux it, and map that to the nsOggCodecState
// in mCodecStates.
codecState = nsOggCodecState::Create(&page);
#ifdef DEBUG
PRBool r =
#endif
mCodecStates.Put(serial, codecState);
DebugOnly<PRBool> r = mCodecStates.Put(serial, codecState);
NS_ASSERTION(r, "Failed to insert into mCodecStates");
bitstreams.AppendElement(codecState);
mKnownStreams.AppendElement(serial);
@ -227,11 +230,6 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
{
mSkeletonState = static_cast<nsSkeletonState*>(codecState);
}
} else {
// We've encountered the a non Beginning Of Stream page. No more
// BOS pages can follow in this Ogg segment, so there will be no other
// bitstreams in the Ogg (unless it's invalid).
readAllBOS = PR_TRUE;
}
mCodecStates.Get(serial, &codecState);

View File

@ -207,6 +207,7 @@ _TEST_FILES += \
bug604067.webm \
chain.ogv \
dirac.ogg \
multiple-bos.ogg \
split.webm \
seek.ogv \
seek.webm \

View File

@ -94,10 +94,10 @@ var gPlayTests = [
{ name:"chain.ogv", type:"video/ogg", duration:Number.NaN },
{ name:"bug523816.ogv", type:"video/ogg", duration:0.533 },
{ name:"bug495129.ogv", type:"video/ogg", duration:2.41 },
{ name:"bug498380.ogv", type:"video/ogg", duration:0.533 },
{ name:"bug495794.ogg", type:"audio/ogg", duration:0.3 },
{ name:"bug557094.ogv", type:"video/ogg", duration:0.24 },
{ name:"multiple-bos.ogg", type:"video/ogg", duration:0.431 },
{ name:"audio-overhang.ogg", type:"audio/ogg", duration:2.3 },
{ name:"video-overhang.ogg", type:"audio/ogg", duration:3.966 },

Binary file not shown.