Log aac details found in codec_data.
authorStefan Kost <ensonic@users.sf.net>
Fri, 23 Jan 2009 14:00:10 +0000 (16:00 +0200)
committerStefan Kost <ensonic@users.sf.net>
Fri, 23 Jan 2009 14:00:10 +0000 (16:00 +0200)
ext/faad/gstfaad.c
gst/aacparse/gstaacparse.c

index f1ba39f655fae5b3ec860912232037c76ee21972..b861844ad3de49cb22e2920e10896bbf6fcdf66e 100644 (file)
@@ -317,11 +317,23 @@ gst_faad_setcaps (GstPad * pad, GstCaps * caps)
     if (csize < 2)
       goto wrong_length;
 
+    GST_DEBUG ("codec_data: object_type=%d, sample_rate=%d, channels=%d",
+        ((cdata[0] & 0xf8) >> 3),
+        (((cdata[0] & 0x07) << 1) | ((cdata[1] & 0x80) >> 7)),
+        ((cdata[1] & 0x78) >> 3));
+
     /* someone forgot that char can be unsigned when writing the API */
     if ((gint8) faacDecInit2 (faad->handle, cdata, csize, &samplerate,
             &channels) < 0)
       goto init_failed;
 
+    if (channels != ((cdata[1] & 0x78) >> 3)) {
+      /* https://bugs.launchpad.net/ubuntu/+source/faad2/+bug/290259 */
+      GST_WARNING_OBJECT (faad,
+          "buggy faad version, wrong nr of channels %d instead of %d", channels,
+          ((cdata[1] & 0x78) >> 3));
+    }
+
     GST_DEBUG_OBJECT (faad, "codec_data init: channels=%u, rate=%u", channels,
         samplerate);
 
index 22108e925a95157432124298e5fad1f9d60ae6e1..1534812afd19319165e2f0bcf124883c8cdfda55 100644 (file)
@@ -272,6 +272,9 @@ gst_aacparse_sink_setcaps (GstBaseParse * parse, GstCaps * caps)
       aacparse->channels = (buffer[1] & 0x78) >> 3;
       aacparse->header_type = DSPAAC_HEADER_NONE;
       aacparse->mpegversion = 4;
+
+      GST_DEBUG ("codec_data: object_type=%d, sample_rate=%d, channels=%d",
+          aacparse->object_type, aacparse->sample_rate, aacparse->channels);
     } else
       return FALSE;
   }