From 7fae33a661158b061b9466d74cb090c222f3d4d5 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 18 Nov 2011 12:32:13 +0100 Subject: [PATCH] h264parse: fix up AU collection processing On the one hand, no need to collect nal if processing last one. On the other hand, ensure AU collection processing to have sufficient next NAL data in normal cases. Fixes #663180. --- gst/videoparsers/gsth264parse.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index d813127ef8..2f80913d00 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -633,6 +633,16 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, nalu.offset + nalu.size); if (!h264parse->nalu.size && !h264parse->nalu.valid) h264parse->nalu = nalu; + /* need 2 bytes of next nal */ + if (nalu.offset + nalu.size + 4 + 2 > size) { + if (GST_BASE_PARSE_DRAINING (parse)) { + drain = TRUE; + } else { + GST_DEBUG_OBJECT (h264parse, "need more bytes of next nal"); + current_off = nalu.sc_offset; + goto more; + } + } break; case GST_H264_PARSER_BROKEN_LINK: return FALSE; @@ -691,7 +701,8 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, data, nalu.offset, nalu.size); gst_h264_parse_process_nal (h264parse, &nalu); - if (gst_h264_parse_collect_nal (h264parse, data, size, &nalu) || drain) + /* if no next nal, we know it's complete here */ + if (drain || gst_h264_parse_collect_nal (h264parse, data, size, &nalu)) break; }