From 1b45e68ef6a41e78ac1446407740ee10f1806497 Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Tue, 7 Aug 2012 16:48:20 -0400 Subject: [PATCH] * #14455: audiortp: don't destroy noise suppress if not holding the audioProcessMutex --- daemon/src/audio/audiortp/audio_rtp_record_handler.cpp | 7 +++++-- daemon/src/audio/noisesuppress.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp b/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp index eb70e54011..119db446ef 100644 --- a/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp +++ b/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp @@ -88,8 +88,11 @@ AudioRtpRecord::~AudioRtpRecord() delete converterDecode_; delete audioCodec_; #if HAVE_SPEEXDSP - delete noiseSuppressEncode_; - delete noiseSuppressDecode_; + { + ost::MutexLock lock(audioProcessMutex_); + delete noiseSuppressDecode_; + delete noiseSuppressEncode_; + } #endif } diff --git a/daemon/src/audio/noisesuppress.cpp b/daemon/src/audio/noisesuppress.cpp index 24d6d7302b..d017611119 100644 --- a/daemon/src/audio/noisesuppress.cpp +++ b/daemon/src/audio/noisesuppress.cpp @@ -59,10 +59,13 @@ NoiseSuppress::NoiseSuppress(int smplPerFrame, int samplingRate) : NoiseSuppress::~NoiseSuppress() { speex_preprocess_state_destroy(noiseState_); + noiseState_ = 0; } void NoiseSuppress::process(SFLDataFormat *data, int samples) { - assert(smplPerFrame_ == samples); - speex_preprocess_run(noiseState_, data); + if (noiseState_) { + assert(smplPerFrame_ == samples); + speex_preprocess_run(noiseState_, data); + } } -- GitLab