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

Commit d0e64b13 authored by Shunkai Yao's avatar Shunkai Yao
Browse files

Check work buffer size before effect process

Bug: 321543210
Test: atest VtsHalAudioEffectTargetTest
Change-Id: I227197f0107f66866d099fb4d160bdb46a65b7df
parent 76dbfeca
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -195,6 +195,8 @@ void DownmixImpl::process() {
        const auto availableToWrite = outputMQ->availableToWrite() *
                                      mImplContext->getInputFrameSize() /
                                      mImplContext->getOutputFrameSize();
        assert(mImplContext->getWorkBufferSize() >=
               std::max(availableToRead(), availableToWrite));
        auto processSamples = std::min(availableToRead, availableToWrite);
        if (processSamples) {
            inputMQ->read(buffer, processSamples);