diff --git a/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp b/daemon/src/audio/audiortp/audio_rtp_record_handler.cpp index eb70e5401110dca915348b48b319792dc28d133e..119db446ef292e2da69eec34a6e6eb44f8362f43 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 24d6d7302b6982a78212a23f2e9cdb889ca52c7b..d0176111190c1041122a7bf5fad8db28dd087917 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); + } }