[vlc-commits] equalizer: reduce PreampCallback contention scope

Rémi Denis-Courmont git at videolan.org
Sat May 24 05:37:19 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 22 21:49:41 2014 +0800| [b4cd28b3c163722479b39a8e05a295c9e9a3dc5f] | committer: Rémi Denis-Courmont

equalizer: reduce PreampCallback contention scope

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b4cd28b3c163722479b39a8e05a295c9e9a3dc5f
---

 modules/audio_filter/equalizer.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/audio_filter/equalizer.c b/modules/audio_filter/equalizer.c
index 47311f3..2c35aaa 100644
--- a/modules/audio_filter/equalizer.c
+++ b/modules/audio_filter/equalizer.c
@@ -554,16 +554,18 @@ static int PreampCallback( vlc_object_t *p_this, char const *psz_cmd,
 {
     VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
     filter_sys_t *p_sys = p_data;
+    float preamp;
 
-    if( newval.f_float < -20.0f )
-        newval.f_float = -20.0f;
-    else if( newval.f_float > 20.0f )
-        newval.f_float = 20.0f;
+    if( newval.f_float < -20.f )
+        preamp = .1f;
+    else if( newval.f_float < 20.f )
+        preamp = powf( 10.f, newval.f_float / 20.f );
+    else
+        preamp = 10.f;
 
     vlc_mutex_lock( &p_sys->lock );
-    p_sys->f_gamp = powf( 10.0f, newval.f_float / 20.0f );
+    p_sys->f_gamp = preamp;
     vlc_mutex_unlock( &p_sys->lock );
-
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list