From f4e560ef116a71a8d407b615be19e1f0ddf438c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Mon, 1 Oct 2007 23:43:57 +0200 Subject: Fix incorrect H.264 detection on successive MPEG1/2 B frames. Successive MPEG1/2 B frames (each with a slice #9) could incorrectly lead to the assumption of a H.264 stream, as sequence or group start codes were not seen for these frames. So the detection logic interpreted the slice #9 start codes as H.264 access unit delimiters and therefore incorrectly switched to H.264 buffer type instead of MPEG1/2. Extending the detection logic to consider MPEG1/2 picture start codes as well (which do not appear in H.264 streams), prevents false positives. --- src/demuxers/demux_mpeg_pes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index fbfde4e60..9ef38f97d 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -1110,7 +1110,7 @@ static int32_t parse_video_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elemen uint8_t *pp = p + 2, *pp_limit = p + payload_size - 1; while (0 < pp && pp < pp_limit) { if (pp[0] == 0x01 && pp[-1] == 0x00 && pp[-2] == 0x00) { - if (pp[1] >= 0x80) { /* MPEG 1/2 start code */ + if (pp[1] >= 0x80 || !pp[1]) { /* MPEG 1/2 start code */ this->mpeg12_h264_detected = 2; break; } else { -- cgit v1.2.3