From fd261e10999a090555c149eca840c774aa147acc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 4 Jul 2016 16:58:38 +0200 Subject: [PATCH] aacparse: Reject raw AAC if no codec_data is found in the caps If necessary, a demuxer will have to invent something here but this is only a problem with non-conformant files anyway. --- gst/audioparsers/gstaacparse.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c index a23a0a9..087b43c 100644 --- a/gst/audioparsers/gstaacparse.c +++ b/gst/audioparsers/gstaacparse.c @@ -326,17 +326,26 @@ gst_aac_parse_sink_setcaps (GstBaseParse * parse, GstCaps * caps) gst_aac_parse_set_src_caps (aacparse, caps); if (aacparse->header_type == aacparse->output_header_type) gst_base_parse_set_passthrough (parse, TRUE); - } else + } else { return FALSE; + } /* caps info overrides */ gst_structure_get_int (structure, "rate", &aacparse->sample_rate); gst_structure_get_int (structure, "channels", &aacparse->channels); } else { - aacparse->sample_rate = 0; - aacparse->channels = 0; - aacparse->header_type = DSPAAC_HEADER_NOT_PARSED; - gst_base_parse_set_passthrough (parse, FALSE); + const gchar *stream_format = + gst_structure_get_string (structure, "stream-format"); + + if (g_strcmp0 (stream_format, "raw") == 0) { + GST_ERROR_OBJECT (parse, "Need codec_data for raw AAC"); + return FALSE; + } else { + aacparse->sample_rate = 0; + aacparse->channels = 0; + aacparse->header_type = DSPAAC_HEADER_NOT_PARSED; + gst_base_parse_set_passthrough (parse, FALSE); + } } return TRUE; -- 2.7.4