equalizer: fix dynamic changes on bands
authorLuis de Bethencourt <luis.bg@samsung.com>
Tue, 21 Apr 2015 15:34:21 +0000 (16:34 +0100)
committerLuis de Bethencourt <luis.bg@samsung.com>
Wed, 22 Apr 2015 09:38:39 +0000 (10:38 +0100)
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

gst/equalizer/gstiirequalizer.c

index e912ca5..eb23d21 100644 (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);