iirequalizer: fix equalizer and unit test
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 6 Feb 2012 14:20:55 +0000 (15:20 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 6 Feb 2012 14:20:55 +0000 (15:20 +0100)
gst/equalizer/gstiirequalizer.c
tests/check/elements/equalizer.c

index 09dfc8b..be90306 100644 (file)
@@ -612,12 +612,12 @@ update_coefficients (GstIirEqualizer * equ)
 
 /* Must be called with transform lock! */
 static void
-alloc_history (GstIirEqualizer * equ)
+alloc_history (GstIirEqualizer * equ, const GstAudioInfo * info)
 {
   /* free + alloc = no memcpy */
   g_free (equ->history);
   equ->history =
-      g_malloc0 (equ->history_size * GST_AUDIO_FILTER_CHANNELS (equ) *
+      g_malloc0 (equ->history_size * GST_AUDIO_INFO_CHANNELS (info) *
       equ->freq_band_count);
 }
 
@@ -667,7 +667,7 @@ gst_iir_equalizer_compute_frequencies (GstIirEqualizer * equ, guint new_count)
     }
   }
 
-  alloc_history (equ);
+  alloc_history (equ, GST_AUDIO_FILTER_INFO (equ));
 
   /* set center frequencies and name band objects
    * FIXME: arg! we can't change the name of parented objects :(
@@ -851,7 +851,7 @@ gst_iir_equalizer_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
   }
   BANDS_UNLOCK (equ);
 
-  gst_buffer_map (buf, &map, GST_MAP_WRITE);
+  gst_buffer_map (buf, &map, GST_MAP_READWRITE);
   equ->process (equ, map.data, map.size, channels);
   gst_buffer_unmap (buf, &map);
 
@@ -880,7 +880,7 @@ gst_iir_equalizer_setup (GstAudioFilter * audio, const GstAudioInfo * info)
       return FALSE;
   }
 
-  alloc_history (equ);
+  alloc_history (equ, info);
   return TRUE;
 }
 
index 5fb290a..6e96428 100644 (file)
@@ -35,6 +35,7 @@ GstPad *mysrcpad, *mysinkpad;
 #define EQUALIZER_CAPS_STRING                     \
     "audio/x-raw, "                               \
     "format = (string) "GST_AUDIO_NE (F64) ", "   \
+    "layout = (string) interleaved, "             \
     "channels = (int) 1, "                        \
     "rate = (int) 48000"
 
@@ -43,6 +44,7 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS ("audio/x-raw, "
         "format = (string) " GST_AUDIO_NE (F64) ", "
+        "layout = (string) interleaved, "
         "channels = (int) 1, " "rate = (int) 48000")
     );
 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
@@ -50,6 +52,7 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS ("audio/x-raw, "
         "format = (string) " GST_AUDIO_NE (F64) ", "
+        "layout = (string) interleaved, "
         "channels = (int) 1, " "rate = (int) 48000")
     );