diff --git a/gst/aacparse/gstaacparse.c b/gst/aacparse/gstaacparse.c index fdbcfb5675..526e1c9d3d 100644 --- a/gst/aacparse/gstaacparse.c +++ b/gst/aacparse/gstaacparse.c @@ -585,7 +585,6 @@ gst_aacparse_check_valid_frame (GstBaseParse * parse, { const guint8 *data; GstAacParse *aacparse; - guint needed_data = 1024; gboolean ret = FALSE; aacparse = GST_AACPARSE (parse); @@ -601,22 +600,35 @@ gst_aacparse_check_valid_frame (GstBaseParse * parse, /* There is nothing to parse */ *framesize = GST_BUFFER_SIZE (buffer); ret = TRUE; - } - else if (aacparse->header_type == DSPAAC_HEADER_NOT_PARSED || + } else if (aacparse->header_type == DSPAAC_HEADER_NOT_PARSED || aacparse->sync == FALSE) { + ret = gst_aacparse_detect_stream (aacparse, data, GST_BUFFER_SIZE (buffer), 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) { + guint needed_data = 1024; + ret = gst_aacparse_check_adts_frame (aacparse, 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; }