From cb6c06ce98be1742683574b697b69313002cdd1b Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 4 Jun 2015 16:21:06 -0700 Subject: Use only strong references to AudioEffect Do not use raw pointer to native AudioEffect objects. Bug: 21629892. Change-Id: I25dbd5fb27293653df063add5fd4d58f2f605cd1 --- src/jni/rtp/AudioGroup.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/jni/rtp/AudioGroup.cpp b/src/jni/rtp/AudioGroup.cpp index e199b97..55c6081 100644 --- a/src/jni/rtp/AudioGroup.cpp +++ b/src/jni/rtp/AudioGroup.cpp @@ -837,7 +837,7 @@ bool AudioGroup::DeviceThread::threadLoop() // check if platform supports echo cancellation and do not active local echo suppression in // this case EchoSuppressor *echo = NULL; - AudioEffect *aec = NULL; + sp aec; if (mode == ECHO_SUPPRESSION) { if (mGroup->platformHasAec()) { aec = new AudioEffect(FX_IID_AEC, @@ -852,12 +852,11 @@ bool AudioGroup::DeviceThread::threadLoop() if (status == NO_ERROR || status == ALREADY_EXISTS) { aec->setEnabled(true); } else { - delete aec; - aec = NULL; + aec.clear(); } } // Create local echo suppressor if platform AEC cannot be used. - if (aec == NULL) { + if (aec == 0) { echo = new EchoSuppressor(sampleCount, (track->latency() + record->latency()) * sampleRate / 1000); } @@ -933,7 +932,6 @@ bool AudioGroup::DeviceThread::threadLoop() exit: delete echo; - delete aec; return true; } -- cgit v1.2.3