diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c index 8e4e212537..a4c09c0acf 100644 --- a/gst-libs/gst/codecparsers/gsth264parser.c +++ b/gst-libs/gst/codecparsers/gsth264parser.c @@ -1124,8 +1124,8 @@ gst_h264_parser_identify_nalu (GstH264NalParser * nalparser, { gint off1, off2; - if (size - 4 <= offset) { - GST_DEBUG ("Can't parse, buffer is to small size %u, offset %u", size, + if (size - offset < 4) { + GST_DEBUG ("Can't parse, buffer has too small size %u, offset %u", size, offset); return GST_H264_PARSER_ERROR; } @@ -1153,6 +1153,13 @@ gst_h264_parser_identify_nalu (GstH264NalParser * nalparser, nalu->data = (guint8 *) data; set_nalu_datas (nalu); + 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"); + nalu->size = 0; + return GST_H264_PARSER_OK; + } + off2 = scan_for_start_codes (data + nalu->offset, size - nalu->offset); if (off2 < 0) { GST_DEBUG ("Nal start %d, No end found", nalu->offset);