summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-06-04 16:21:06 -0700
committerEric Laurent <elaurent@google.com>2015-06-08 18:54:06 -0700
commitcb6c06ce98be1742683574b697b69313002cdd1b (patch)
tree1e69502c121b51c24e9996e857a3588377bb50e3
parent5a4b1c96e2722a57a4b33519a0a0015e70c9420e (diff)
downloadvoip-cb6c06ce98be1742683574b697b69313002cdd1b.tar.gz
Use only strong references to AudioEffect
Do not use raw pointer to native AudioEffect objects. Bug: 21629892. Change-Id: I25dbd5fb27293653df063add5fd4d58f2f605cd1
-rw-r--r--src/jni/rtp/AudioGroup.cpp8
1 files 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<AudioEffect> 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;
}