diff -r 337ba58a8d26 gstflvdemux.c
--- gst/flv/gstflvdemux.c	Mon Dec 06 15:06:34 2010 +0000
+++ gst/flv/gstflvdemux.c	Mon Dec 06 17:53:11 2010 +0000
@@ -838,6 +838,26 @@
 
   if (demux->audio_codec_tag == 10) {
     guint8 aac_packet_type = GST_READ_UINT8 (data + 8);
+    /* AAC Audio Sample Frequency Index Table as per 13818-7 */
+    static gint aac_freq[] = {
+	    96000, 88200, 64000, 48000, 44100,
+	    32000, 24000, 22050, 16000, 12000,
+	    11025, 8000, 7350
+    };
+    gboolean renegociate = FALSE;
+
+    if (demux->audio_codec_data &&
+       (GST_BUFFER_SIZE(demux->audio_codec_data) >= 2)) {
+	    gint freq_index = ((GST_READ_UINT16_BE (GST_BUFFER_DATA(demux->audio_codec_data)) & 0x0780 ) >> 7);
+
+	    if (freq_index < G_N_ELEMENTS(aac_freq)) {
+		    if (rate != aac_freq[freq_index]) {
+			    GST_LOG_OBJECT (demux, "Ajusting AAC sample rate %d -> %d", rate, aac_freq[freq_index]);
+			    rate = aac_freq[freq_index];
+			    renegociate = TRUE;
+		    }
+	    }
+    }
 
     switch (aac_packet_type) {
       case 0:
@@ -855,7 +875,11 @@
       }
       case 1:
         /* AAC raw packet */
-        GST_LOG_OBJECT (demux, "got a raw AAC audio packet");
+	GST_LOG_OBJECT (demux, "got a raw AAC audio packet");
+
+	if (renegociate)
+		gst_flv_demux_audio_negotiate (demux, codec_tag, rate, channels, width);
+
         break;
       default:
         GST_WARNING_OBJECT (demux, "invalid AAC packet type %u",
