Fixed problems in audio effect volume control.
Fixed the following problems in audio effect volume control in AudioFlinger:
- Make sure that the volumes returned by EffectChain::setVolume_l() are correct even is
no change is detected since last call
- Do not use isEnabled() to validate volume control but mState >= ACTIVE instead as the volume control
must be also active in STOPPING and STOPPED states.
Change-Id: Id62da3164fad500ee8a5efd6cd78c77e8fdcb541
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index bcda06e..ec13557 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -230,9 +230,6 @@
if (pContext == NULL) {
return -EINVAL;
}
- if (pContext->mState != VISUALIZER_STATE_ACTIVE) {
- return -ENODATA;
- }
if (inBuffer == NULL || inBuffer->raw == NULL ||
outBuffer == NULL || outBuffer->raw == NULL ||
@@ -269,6 +266,9 @@
memcpy(outBuffer->raw, inBuffer->raw, outBuffer->frameCount * 2 * sizeof(int16_t));
}
}
+ if (pContext->mState != VISUALIZER_STATE_ACTIVE) {
+ return -ENODATA;
+ }
return 0;
} // end Visualizer_process