aacparse: Refactor check_valid_frame to expose broken code

Just moving code around and removing an unhelpful/misleading comment.
This commit is contained in:
René Stadler 2009-03-19 00:32:40 +02:00
parent fcfc22f6f6
commit 3f90e6ff13

View file

@ -585,7 +585,6 @@ gst_aacparse_check_valid_frame (GstBaseParse * parse,
{ {
const guint8 *data; const guint8 *data;
GstAacParse *aacparse; GstAacParse *aacparse;
guint needed_data = 1024;
gboolean ret = FALSE; gboolean ret = FALSE;
aacparse = GST_AACPARSE (parse); aacparse = GST_AACPARSE (parse);
@ -601,22 +600,35 @@ gst_aacparse_check_valid_frame (GstBaseParse * parse,
/* There is nothing to parse */ /* There is nothing to parse */
*framesize = GST_BUFFER_SIZE (buffer); *framesize = GST_BUFFER_SIZE (buffer);
ret = TRUE; ret = TRUE;
}
else if (aacparse->header_type == DSPAAC_HEADER_NOT_PARSED || } else if (aacparse->header_type == DSPAAC_HEADER_NOT_PARSED ||
aacparse->sync == FALSE) { aacparse->sync == FALSE) {
ret = gst_aacparse_detect_stream (aacparse, data, GST_BUFFER_SIZE (buffer), ret = gst_aacparse_detect_stream (aacparse, data, GST_BUFFER_SIZE (buffer),
framesize, skipsize); framesize, skipsize);
if (!ret) {
GST_DEBUG ("buffer didn't contain valid frame, skip = %d", *skipsize);
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), 1024);
}
} else if (aacparse->header_type == DSPAAC_HEADER_ADTS) { } else if (aacparse->header_type == DSPAAC_HEADER_ADTS) {
guint needed_data = 1024;
ret = gst_aacparse_check_adts_frame (aacparse, data, ret = gst_aacparse_check_adts_frame (aacparse, data,
GST_BUFFER_SIZE (buffer), framesize, &needed_data); GST_BUFFER_SIZE (buffer), framesize, &needed_data);
if (!ret) {
GST_DEBUG ("buffer didn't contain valid frame");
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse),
needed_data);
}
} else {
GST_DEBUG ("buffer didn't contain valid frame");
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), 1024);
} }
if (!ret) {
/* Increase the block size, we want to find the header by ourselves */
GST_DEBUG ("buffer didn't contain valid frame, skip = %d", *skipsize);
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), needed_data);
}
return ret; return ret;
} }