From: Arun Raghavan Date: Mon, 13 Jun 2011 20:42:01 +0000 (-0700) Subject: echo-cancel: More preprocessing fixes X-Git-Tag: 1.0_branch~556 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e9328cb934ecbc1bec6acfd40994d8a048dac72;p=profile%2Fivi%2Fpulseaudio.git echo-cancel: More preprocessing fixes The speex_preprocess_ctl() function takes a spx_int32_t, but we've been passing a pa_bool_t, which could potentially crash. --- diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index c406508..96eb9ef 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -1476,6 +1476,8 @@ int pa__init(pa_module*m) { } if (u->ec->agc || u->ec->denoise || u->ec->echo_suppress) { + spx_int32_t tmp; + if (source_ss.channels != 1) { pa_log("AGC, denoising and echo suppression only work with channels=1"); goto fail; @@ -1483,8 +1485,10 @@ int pa__init(pa_module*m) { u->ec->pp_state = speex_preprocess_state_init(u->blocksize / pa_frame_size(&source_ss), source_ss.rate); - speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_AGC, &u->ec->agc); - speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_DENOISE, &u->ec->denoise); + tmp = u->ec->agc; + speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_AGC, &tmp); + tmp = u->ec->denoise; + speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_DENOISE, &tmp); if (u->ec->echo_suppress) { if (u->ec->echo_suppress_attenuation) speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS, &u->ec->echo_suppress_attenuation);