From ea03a621a8e4c5caf9e8eb96b53be59a098aa66e Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 5 Jun 2014 14:06:04 +0200 Subject: [PATCH] Add class mutex instead of deprecated static mutex. --- gst/moodbar/gstfftwspectrum.c | 9 ++++++--- gst/moodbar/gstfftwspectrum.h | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gst/moodbar/gstfftwspectrum.c b/gst/moodbar/gstfftwspectrum.c index 8b32e93b8..2fa3e8570 100644 --- a/gst/moodbar/gstfftwspectrum.c +++ b/gst/moodbar/gstfftwspectrum.c @@ -164,6 +164,8 @@ gst_fftwspectrum_class_init (GstFFTWSpectrumClass * klass) gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_fftwspectrum_change_state); + + g_mutex_init(&klass->mutex); } /* initialize the new element @@ -221,6 +223,8 @@ gst_fftwspectrum_init (GstFFTWSpectrum * conv, conv->def_size = DEF_SIZE_DEFAULT; conv->def_step = DEF_STEP_DEFAULT; conv->hi_q = HIQUALITY_DEFAULT; + + conv->mutex = &gclass->mutex; } static void @@ -303,13 +307,12 @@ alloc_fftw_data (GstFFTWSpectrum *conv) * implementing filters. */ - static GStaticMutex mutex = G_STATIC_MUTEX_INIT; - g_static_mutex_lock(&mutex); + g_mutex_lock(conv->mutex); conv->fftw_plan = fftw_plan_dft_r2c_1d(conv->size, conv->fftw_in, (fftw_complex *) conv->fftw_out, conv->hi_q ? FFTW_MEASURE : FFTW_ESTIMATE); - g_static_mutex_unlock(&mutex); + g_mutex_unlock(conv->mutex); } diff --git a/gst/moodbar/gstfftwspectrum.h b/gst/moodbar/gstfftwspectrum.h index fc7647e7c..f06d2b0e2 100644 --- a/gst/moodbar/gstfftwspectrum.h +++ b/gst/moodbar/gstfftwspectrum.h @@ -54,11 +54,15 @@ struct _GstFFTWSpectrum /* Properties */ gint32 def_size, def_step; gboolean hi_q; + + GMutex* mutex; }; struct _GstFFTWSpectrumClass { GstElementClass parent_class; + + GMutex mutex; }; GType gst_fftwspectrum_get_type (void);