Fix bug: possible endless loop in pes audio parser.

This commit is contained in:
Johns 2012-10-19 15:36:41 +02:00
parent f640ebdeb5
commit 92b4203644
2 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Fix bug: with some streams endless loop in pes audio parser.
Report correct video size in cSoftHdDevice::GetVideoSize. Report correct video size in cSoftHdDevice::GetVideoSize.
Add picture adjustment support for vdpau. Add picture adjustment support for vdpau.
Revert "mpeg_vdpau" back to "mpegvideo_vdpau". Revert "mpeg_vdpau" back to "mpegvideo_vdpau".

View File

@ -718,13 +718,16 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size,
// have header upto size bits // have header upto size bits
if (pesdx->HeaderIndex == PES_HEADER_SIZE) { if (pesdx->HeaderIndex == PES_HEADER_SIZE) {
if ((pesdx->Header[6] & 0xC0) == 0x80) { if ((pesdx->Header[6] & 0xC0) != 0x80) {
pesdx->HeaderSize += pesdx->Header[8];
} else {
Error(_("pesdemux: mpeg1 pes packet unsupported\n")); Error(_("pesdemux: mpeg1 pes packet unsupported\n"));
pesdx->State = PES_SKIP; pesdx->State = PES_SKIP;
return; return;
} }
// have pes extension
if (!pesdx->Header[8]) {
goto empty_header;
}
pesdx->HeaderSize += pesdx->Header[8];
// have complete header // have complete header
} else if (pesdx->HeaderIndex == pesdx->HeaderSize) { } else if (pesdx->HeaderIndex == pesdx->HeaderSize) {
int64_t pts; int64_t pts;
@ -753,6 +756,7 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size,
pts, dts); pts, dts);
} }
empty_header:
pesdx->State = PES_INIT; pesdx->State = PES_INIT;
if (pesdx->StartCode == PES_PRIVATE_STREAM1) { if (pesdx->StartCode == PES_PRIVATE_STREAM1) {
// only private stream 1, has sub streams // only private stream 1, has sub streams