Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8293e19d authored by Eric Laurent's avatar Eric Laurent
Browse files

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
parent c35761e1
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -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;
            }
            if (effect->state != PREPROC_EFFECT_STATE_ACTIVE) {
                *(int *)pReplyData = Effect_SetState(effect, PREPROC_EFFECT_STATE_CONFIG);
            }
            break;

        case EFFECT_CMD_GET_CONFIG: