h264parse: mind to-be-skipped data in subsequent re-used offsets

This commit is contained in:
Mark Nauwelaerts 2011-11-18 15:12:46 +01:00
parent e12044c359
commit 66543b3dd9

View file

@ -653,7 +653,7 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
*skipsize = nalu.offset; *skipsize = nalu.offset;
GST_DEBUG_OBJECT (h264parse, "skipping broken nal"); GST_DEBUG_OBJECT (h264parse, "skipping broken nal");
return FALSE; goto invalid;
} else { } else {
nalu.size = 0; nalu.size = 0;
goto end; goto end;
@ -675,7 +675,7 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
/* Can't parse the nalu */ /* Can't parse the nalu */
if (size - h264parse->nalu.offset < 2) { if (size - h264parse->nalu.offset < 2) {
*skipsize = nalu.offset; *skipsize = nalu.offset;
return FALSE; goto invalid;
} }
/* We parse it anyway */ /* We parse it anyway */
@ -715,6 +715,10 @@ more:
if (!h264parse->nalu.size) { if (!h264parse->nalu.size) {
/* skip up to initial startcode */ /* skip up to initial startcode */
*skipsize = h264parse->nalu.sc_offset; *skipsize = h264parse->nalu.sc_offset;
/* but mind some stuff will have been skipped */
g_assert (current_off >= *skipsize);
current_off -= *skipsize;
h264parse->nalu.sc_offset = 0;
} else { } else {
*skipsize = 0; *skipsize = 0;
} }
@ -723,6 +727,10 @@ more:
h264parse->current_off = current_off; h264parse->current_off = current_off;
return FALSE; return FALSE;
invalid:
gst_h264_parse_reset_frame (h264parse);
return FALSE;
} }
/* byte together avc codec data based on collected pps and sps so far */ /* byte together avc codec data based on collected pps and sps so far */