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.
This commit is contained in:
Mark Nauwelaerts 2011-11-18 12:32:13 +01:00
parent 66543b3dd9
commit 7fae33a661

View file

@ -633,6 +633,16 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
nalu.offset + nalu.size); nalu.offset + nalu.size);
if (!h264parse->nalu.size && !h264parse->nalu.valid) if (!h264parse->nalu.size && !h264parse->nalu.valid)
h264parse->nalu = nalu; 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; break;
case GST_H264_PARSER_BROKEN_LINK: case GST_H264_PARSER_BROKEN_LINK:
return FALSE; return FALSE;
@ -691,7 +701,8 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
data, nalu.offset, nalu.size); data, nalu.offset, nalu.size);
gst_h264_parse_process_nal (h264parse, &nalu); 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; break;
} }