diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c index 72abb130cd..93bea97354 100644 --- a/gst-libs/gst/codecparsers/gsth264parser.c +++ b/gst-libs/gst/codecparsers/gsth264parser.c @@ -1226,15 +1226,18 @@ gst_h264_parser_identify_nalu_unchecked (GstH264NalParser * nalparser, nalu->valid = TRUE; nalu->sc_offset = offset + off1; - /* sc might have 2 or 3 0-bytes */ - if (nalu->sc_offset > 0 && data[nalu->sc_offset - 1] == 00) - nalu->sc_offset--; nalu->offset = offset + off1 + 3; nalu->data = (guint8 *) data; set_nalu_datas (nalu); + /* sc might have 2 or 3 0-bytes */ + if (nalu->sc_offset > 0 && data[nalu->sc_offset - 1] == 00 + && (nalu->type == GST_H264_NAL_SPS || nalu->type == GST_H264_NAL_PPS + || nalu->type == GST_H264_NAL_AU_DELIMITER)) + nalu->sc_offset--; + if (nalu->type == GST_H264_NAL_SEQ_END || nalu->type == GST_H264_NAL_STREAM_END) { GST_DEBUG ("end-of-seq or end-of-stream nal found");