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

Commit 99bbeb8e authored by Shunkai Yao's avatar Shunkai Yao Committed by Gerrit Code Review
Browse files

Merge "Align EffectContext workbuffer size to FMQ size" into main

parents 7a03de84 de16db4d
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -63,13 +63,18 @@ void EffectContext::resetBuffer() {
}

void EffectContext::dupeFmqWithReopen(IEffect::OpenEffectReturn* effectRet) {
    const size_t inBufferSizeInFloat = mCommon.input.frameCount * mInputFrameSize / sizeof(float);
    const size_t outBufferSizeInFloat =
            mCommon.output.frameCount * mOutputFrameSize / sizeof(float);
    const size_t bufferSize = std::max(inBufferSizeInFloat, outBufferSizeInFloat);
    if (!mInputMQ) {
        mInputMQ = std::make_shared<DataMQ>(mCommon.input.frameCount * mInputFrameSize /
                                            sizeof(float));
        mInputMQ = std::make_shared<DataMQ>(inBufferSizeInFloat);
    }
    if (!mOutputMQ) {
        mOutputMQ = std::make_shared<DataMQ>(mCommon.output.frameCount * mOutputFrameSize /
                                             sizeof(float));
        mOutputMQ = std::make_shared<DataMQ>(outBufferSizeInFloat);
    }
    if (mWorkBuffer.size() != bufferSize) {
        mWorkBuffer.resize(bufferSize);
    }
    dupeFmq(effectRet);
}
@@ -222,8 +227,6 @@ RetCode EffectContext::updateIOFrameSize(const Parameter::Common& common) {
    }

    if (needUpdateMq) {
        mWorkBuffer.resize(std::max(common.input.frameCount * mInputFrameSize / sizeof(float),
                                    common.output.frameCount * mOutputFrameSize / sizeof(float)));
        return notifyDataMqUpdate();
    }
    return RetCode::SUCCESS;