diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2009-01-13 08:24:25 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2009-01-13 08:24:25 +0000 |
commit | 4b227159cba3b5953d85dd5358cefece06e5d35f (patch) | |
tree | 6630d729b65c51975b5bba695d914cd49b5c14f9 /gst/audiofx/audiocheblimit.c | |
parent | 0016658ace7e5b84095b44ad7bae27218334143b (diff) |
gst/audiofx/: Use a custom mutex for protecting the instance fields instead of the GstObject lock. Using the latter c...
Original commit message from CVS:
* gst/audiofx/audiochebband.c: (gst_audio_cheb_band_class_init),
(gst_audio_cheb_band_init), (gst_audio_cheb_band_finalize),
(gst_audio_cheb_band_set_property):
* gst/audiofx/audiochebband.h:
* gst/audiofx/audiocheblimit.c: (gst_audio_cheb_limit_class_init),
(gst_audio_cheb_limit_init), (gst_audio_cheb_limit_finalize),
(gst_audio_cheb_limit_set_property):
* gst/audiofx/audiocheblimit.h:
* gst/audiofx/audiowsincband.c: (gst_audio_wsincband_class_init),
(gst_audio_wsincband_init), (gst_audio_wsincband_finalize),
(gst_audio_wsincband_set_property):
* gst/audiofx/audiowsincband.h:
* gst/audiofx/audiowsinclimit.c: (gst_audio_wsinclimit_class_init),
(gst_audio_wsinclimit_init), (gst_audio_wsinclimit_finalize),
(gst_audio_wsinclimit_set_property):
* gst/audiofx/audiowsinclimit.h:
Use a custom mutex for protecting the instance fields instead of
the GstObject lock. Using the latter can lead to deadlocks, especially
with the FIR filters when updating the latency.
Diffstat (limited to 'gst/audiofx/audiocheblimit.c')
-rw-r--r-- | gst/audiofx/audiocheblimit.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/gst/audiofx/audiocheblimit.c b/gst/audiofx/audiocheblimit.c index 4d8d311d..b4efbb3a 100644 --- a/gst/audiofx/audiocheblimit.c +++ b/gst/audiofx/audiocheblimit.c @@ -109,6 +109,7 @@ static void gst_audio_cheb_limit_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_audio_cheb_limit_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); +static void gst_audio_cheb_limit_finalize (GObject * object); static gboolean gst_audio_cheb_limit_setup (GstAudioFilter * filter, GstRingBufferSpec * format); @@ -161,6 +162,7 @@ gst_audio_cheb_limit_class_init (GstAudioChebLimitClass * klass) gobject_class->set_property = gst_audio_cheb_limit_set_property; gobject_class->get_property = gst_audio_cheb_limit_get_property; + gobject_class->finalize = gst_audio_cheb_limit_finalize; g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_enum ("mode", "Mode", @@ -203,6 +205,8 @@ gst_audio_cheb_limit_init (GstAudioChebLimit * filter, filter->type = 1; filter->poles = 4; filter->ripple = 0.25; + + filter->lock = g_mutex_new (); } static void @@ -479,6 +483,17 @@ generate_coefficients (GstAudioChebLimit * filter) } static void +gst_audio_cheb_limit_finalize (GObject * object) +{ + GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (object); + + g_mutex_free (filter->lock); + filter->lock = NULL; + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void gst_audio_cheb_limit_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { @@ -486,34 +501,34 @@ gst_audio_cheb_limit_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_MODE: - GST_OBJECT_LOCK (filter); + g_mutex_lock (filter->lock); filter->mode = g_value_get_enum (value); generate_coefficients (filter); - GST_OBJECT_UNLOCK (filter); + g_mutex_unlock (filter->lock); break; case PROP_TYPE: - GST_OBJECT_LOCK (filter); + g_mutex_lock (filter->lock); filter->type = g_value_get_int (value); generate_coefficients (filter); - GST_OBJECT_UNLOCK (filter); + g_mutex_unlock (filter->lock); break; case PROP_CUTOFF: - GST_OBJECT_LOCK (filter); + g_mutex_lock (filter->lock); filter->cutoff = g_value_get_float (value); generate_coefficients (filter); - GST_OBJECT_UNLOCK (filter); + g_mutex_unlock (filter->lock); break; case PROP_RIPPLE: - GST_OBJECT_LOCK (filter); + g_mutex_lock (filter->lock); filter->ripple = g_value_get_float (value); generate_coefficients (filter); - GST_OBJECT_UNLOCK (filter); + g_mutex_unlock (filter->lock); break; case PROP_POLES: - GST_OBJECT_LOCK (filter); + g_mutex_lock (filter->lock); filter->poles = GST_ROUND_UP_2 (g_value_get_int (value)); generate_coefficients (filter); - GST_OBJECT_UNLOCK (filter); + g_mutex_unlock (filter->lock); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |