From dd26b14930c07e347173e86f93ece0eb54a19aa4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 6 Feb 2012 15:20:55 +0100 Subject: [PATCH] iirequalizer: fix equalizer and unit test --- gst/equalizer/gstiirequalizer.c | 10 +++++----- tests/check/elements/equalizer.c | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gst/equalizer/gstiirequalizer.c b/gst/equalizer/gstiirequalizer.c index 09dfc8b..be90306 100644 --- a/gst/equalizer/gstiirequalizer.c +++ b/gst/equalizer/gstiirequalizer.c @@ -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; } diff --git a/tests/check/elements/equalizer.c b/tests/check/elements/equalizer.c index 5fb290a..6e96428 100644 --- a/tests/check/elements/equalizer.c +++ b/tests/check/elements/equalizer.c @@ -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") ); -- 2.7.4