[pulseaudio-discuss] [PATCH 03/23] echo-cancel: Fix for webrtc AEC when run from test program

Peter Meerwald pmeerw at pmeerw.net
Wed Feb 13 08:26:50 PST 2013


webrtc crashes with agc enabled when run from test program, i.e.
echo-cancel-test play.raw rec.raw out.raw aec_method=webrtc

==8785== Invalid read of size 8
==8785==    at 0x40A2F6: pa_echo_canceller_get_capture_volume (module-echo-cancel.c:1593)
==8785==    by 0x418EA2F: pa_webrtc_ec_record (webrtc.cc:262)
==8785==    by 0x40C890: main (module-echo-cancel.c:2223)
==8785==  Address 0x28 is not stack'd, malloc'd or (recently) free'd

fix this by checking if ec->msg is set in pa_echo_canceller_get_capture_volume() and
pa_echo_canceller_set_capture_volume() -- the test program has no audio device and
hence no volume control

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/modules/echo-cancel/module-echo-cancel.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 11ad1de..81c0a54 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -1556,11 +1556,15 @@ static int canceller_process_msg_cb(pa_msgobject *o, int code, void *userdata, i
 
 /* Called by the canceller, so source I/O thread context. */
 void pa_echo_canceller_get_capture_volume(pa_echo_canceller *ec, pa_cvolume *v) {
+    if (!ec->msg)
+        return;
     *v = ec->msg->userdata->thread_info.current_volume;
 }
 
 /* Called by the canceller, so source I/O thread context. */
 void pa_echo_canceller_set_capture_volume(pa_echo_canceller *ec, pa_cvolume *v) {
+    if (!ec->msg)
+        return;
     if (!pa_cvolume_equal(&ec->msg->userdata->thread_info.current_volume, v)) {
         pa_cvolume *vol = pa_xnewdup(pa_cvolume, v, 1);
 
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list