equalizer: fix dynamic changes on bands

When we are in passthrough, the transform function doesn't run and if the
passthrough check is in this function it will never be deactivated. Fix this by
checking directly whenever a gain is changed.

Also set the passthrough to TRUE at init because the gains default to 0, so we
can passthrough until any gain property is changed.

https://bugzilla.gnome.org/show_bug.cgi?id=748068
This commit is contained in:
Luis de Bethencourt 2015-04-21 16:34:21 +01:00
parent 476f9957e8
commit c884a3b3a5

View file

@ -49,6 +49,7 @@ static gboolean gst_iir_equalizer_setup (GstAudioFilter * filter,
const GstAudioInfo * info);
static GstFlowReturn gst_iir_equalizer_transform_ip (GstBaseTransform * btrans,
GstBuffer * buf);
static void set_passthrough (GstIirEqualizer * equ);
#define ALLOWED_CAPS \
"audio/x-raw," \
@ -159,6 +160,7 @@ gst_iir_equalizer_band_set_property (GObject * object, guint prop_id,
BANDS_LOCK (equ);
equ->need_new_coefficients = TRUE;
band->gain = gain;
set_passthrough (equ);
BANDS_UNLOCK (equ);
GST_DEBUG_OBJECT (band, "changed gain = %lf ", band->gain);
}
@ -373,7 +375,8 @@ static void
gst_iir_equalizer_init (GstIirEqualizer * eq)
{
g_mutex_init (&eq->bands_lock);
eq->need_new_coefficients = TRUE;
/* Band gains are 0 by default, passthrough until they are changed */
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (eq), TRUE);
}
static void
@ -852,7 +855,6 @@ gst_iir_equalizer_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
BANDS_LOCK (equ);
if (need_new_coefficients) {
update_coefficients (equ);
set_passthrough (equ);
}
BANDS_UNLOCK (equ);