diff options
author | Eric Laurent <elaurent@google.com> | 2012-02-17 17:52:04 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2012-02-17 17:52:04 -0800 |
commit | 76533e94500e5d221ec4a1a5d9c97ea3d75860e4 (patch) | |
tree | ee295fa8ce60d86ffa14021809ce6357c5d61d24 /media/libeffects/preprocessing | |
parent | 3b81acab52b7140c1b8b20be2d67be3e221637e7 (diff) | |
download | frameworks_av-76533e94500e5d221ec4a1a5d9c97ea3d75860e4.zip frameworks_av-76533e94500e5d221ec4a1a5d9c97ea3d75860e4.tar.gz frameworks_av-76533e94500e5d221ec4a1a5d9c97ea3d75860e4.tar.bz2 |
audio preprocessing: fix multiple enable problem
Do not set the effect state back to configured when a configuration
command is received while the effect is enabled. Instead just check that
the new config is the same as current config.
It is normal to receive a config command from the framework while enabled
if a new effect is added on the same session.
Change-Id: I93aa38bf60a3d7cc7729934e87ddd69bf1112cd6
Diffstat (limited to 'media/libeffects/preprocessing')
-rwxr-xr-x | media/libeffects/preprocessing/PreProcessing.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp index 098a1a2..dc27d38 100755 --- a/media/libeffects/preprocessing/PreProcessing.cpp +++ b/media/libeffects/preprocessing/PreProcessing.cpp @@ -845,6 +845,17 @@ int Session_SetConfig(preproc_session_t *session, effect_config_t *config) config->inputCfg.samplingRate, config->inputCfg.channels); int status; + // if at least one process is enabled, do not accept configuration changes + if (session->enabledMsk) { + if (session->samplingRate != config->inputCfg.samplingRate || + session->inChannelCount != inCnl || + session->outChannelCount != outCnl) { + return -ENOSYS; + } else { + return 0; + } + } + // AEC implementation is limited to 16kHz if (config->inputCfg.samplingRate >= 32000 && !(session->createdMsk & (1 << PREPROC_AEC))) { session->apmSamplingRate = 32000; @@ -1287,7 +1298,9 @@ int PreProcessingFx_Command(effect_handle_t self, if (*(int *)pReplyData != 0) { break; } - *(int *)pReplyData = Effect_SetState(effect, PREPROC_EFFECT_STATE_CONFIG); + if (effect->state != PREPROC_EFFECT_STATE_ACTIVE) { + *(int *)pReplyData = Effect_SetState(effect, PREPROC_EFFECT_STATE_CONFIG); + } break; case EFFECT_CMD_GET_CONFIG: |