Bug 1194708: Properly find SPS NAL in some H264 streams. r=kentuckyfriedtakahe

With some encoding, we didn't detect the SPS. With AVC3 stream it would cause playback to never start on mac or linux (ffmpeg)
This commit is contained in:
Jean-Yves Avenard 2015-08-17 10:28:12 +10:00
parent 1a5c4f95d2
commit aedd08d288

View File

@ -274,17 +274,17 @@ AnnexB::ExtractExtraData(const mozilla::MediaRawData* aSample)
case 3: nalLen = reader.ReadU24(); break;
case 4: nalLen = reader.ReadU32(); break;
}
uint8_t nalType = reader.PeekU8();
uint8_t nalType = reader.PeekU8() & 0x1f;
const uint8_t* p = reader.Read(nalLen);
if (!p) {
return extradata.forget();
}
if (nalType == 0x67) { /* SPS */
if (nalType == 0x7) { /* SPS */
numSps++;
spsw.WriteU16(nalLen);
spsw.Write(p, nalLen);
} else if (nalType == 0x68) { /* PPS */
} else if (nalType == 0x8) { /* PPS */
numPps++;
ppsw.WriteU16(nalLen);
ppsw.Write(p, nalLen);