aacparse: perform additional sanity check before confirming ADTS format

... and tweak confusing debug message.
This commit is contained in:
Mark Nauwelaerts 2012-07-06 15:07:51 +02:00
parent 986286a8ea
commit 400bdee601

View file

@ -720,7 +720,7 @@ gst_aac_parse_detect_stream (GstAacParse * aacparse,
if (((data[i] == 0xff) && ((data[i + 1] & 0xf6) == 0xf0)) || if (((data[i] == 0xff) && ((data[i + 1] & 0xf6) == 0xf0)) ||
((data[0] == 0x56) && ((data[1] & 0xe0) == 0xe0)) || ((data[0] == 0x56) && ((data[1] & 0xe0) == 0xe0)) ||
strncmp ((char *) data + i, "ADIF", 4) == 0) { strncmp ((char *) data + i, "ADIF", 4) == 0) {
GST_DEBUG_OBJECT (aacparse, "Found ADIF signature at offset %u", i); GST_DEBUG_OBJECT (aacparse, "Found signature at offset %u", i);
found = TRUE; found = TRUE;
if (i) { if (i) {
@ -745,10 +745,15 @@ gst_aac_parse_detect_stream (GstAacParse * aacparse,
GST_INFO ("ADTS ID: %d, framesize: %d", (data[1] & 0x08) >> 3, *framesize); GST_INFO ("ADTS ID: %d, framesize: %d", (data[1] & 0x08) >> 3, *framesize);
aacparse->header_type = DSPAAC_HEADER_ADTS;
gst_aac_parse_parse_adts_header (aacparse, data, &rate, &channels, gst_aac_parse_parse_adts_header (aacparse, data, &rate, &channels,
&aacparse->object_type, &aacparse->mpegversion); &aacparse->object_type, &aacparse->mpegversion);
if (!channels || !framesize) {
GST_DEBUG_OBJECT (aacparse, "impossible ADTS configuration");
return FALSE;
}
aacparse->header_type = DSPAAC_HEADER_ADTS;
gst_base_parse_set_frame_rate (GST_BASE_PARSE (aacparse), rate, gst_base_parse_set_frame_rate (GST_BASE_PARSE (aacparse), rate,
aacparse->frame_samples, 2, 2); aacparse->frame_samples, 2, 2);