Add logic to read in any data that may have come in during processing.

pull/876/head
Mooneer Salem 2025-05-18 23:03:32 -04:00
parent a2066cb865
commit 11ce99bb6a
1 changed files with 14 additions and 10 deletions

View File

@ -247,16 +247,20 @@ std::shared_ptr<short> ParallelStep::execute(std::shared_ptr<short> inputSamples
void ParallelStep::executeRunnerThread_(ThreadInfo* threadState) void ParallelStep::executeRunnerThread_(ThreadInfo* threadState)
{ {
int samplesIn = codec2_fifo_used(threadState->inputFifo); int samplesIn = 0;
int samplesOut = 0; do
if (codec2_fifo_read(threadState->inputFifo, threadState->tempInput.get(), samplesIn) != 0)
{ {
samplesIn = 0; samplesIn = codec2_fifo_used(threadState->inputFifo);
} int samplesOut = 0;
if (codec2_fifo_read(threadState->inputFifo, threadState->tempInput.get(), samplesIn) != 0)
{
samplesIn = 0;
}
auto output = threadState->step->execute(threadState->tempInput, samplesIn, &samplesOut); auto output = threadState->step->execute(threadState->tempInput, samplesIn, &samplesOut);
if (samplesOut > 0) if (samplesOut > 0)
{ {
codec2_fifo_write(threadState->outputFifo, output.get(), samplesOut); codec2_fifo_write(threadState->outputFifo, output.get(), samplesOut);
} }
} while (codec2_fifo_used(threadState->inputFifo) > 0);
} }