Fix crash in DownmixerBufferProvider
In ag/1768960, I forgot to actually set the buffers for the effect
interface. Without that, a 'process' method was attempting to use null
buffers.
Bug: 34228998
Test: android.media.cts.AudioNativeTest#testPlayStreamData
Change-Id: I904a9c08aa75bd5738b3ce981ee54511f37df7ec
diff --git a/media/libaudiohal/EffectHalLocal.cpp b/media/libaudiohal/EffectHalLocal.cpp
index b4f1934..dd465c3 100644
--- a/media/libaudiohal/EffectHalLocal.cpp
+++ b/media/libaudiohal/EffectHalLocal.cpp
@@ -45,11 +45,21 @@
}
status_t EffectHalLocal::process() {
+ if (mInBuffer == nullptr || mOutBuffer == nullptr) {
+ ALOGE_IF(mInBuffer == nullptr, "Input buffer not set");
+ ALOGE_IF(mOutBuffer == nullptr, "Output buffer not set");
+ return NO_INIT;
+ }
return (*mHandle)->process(mHandle, mInBuffer->audioBuffer(), mOutBuffer->audioBuffer());
}
status_t EffectHalLocal::processReverse() {
if ((*mHandle)->process_reverse != NULL) {
+ if (mInBuffer == nullptr || mOutBuffer == nullptr) {
+ ALOGE_IF(mInBuffer == nullptr, "Input buffer not set");
+ ALOGE_IF(mOutBuffer == nullptr, "Output buffer not set");
+ return NO_INIT;
+ }
return (*mHandle)->process_reverse(
mHandle, mInBuffer->audioBuffer(), mOutBuffer->audioBuffer());
} else {