From 11ce99bb6a9ee2a357e3e15a207c09837f8c0a13 Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Sun, 18 May 2025 23:03:32 -0400 Subject: [PATCH] Add logic to read in any data that may have come in during processing. --- src/pipeline/ParallelStep.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/pipeline/ParallelStep.cpp b/src/pipeline/ParallelStep.cpp index 5c8636dd..08dd194f 100644 --- a/src/pipeline/ParallelStep.cpp +++ b/src/pipeline/ParallelStep.cpp @@ -247,16 +247,20 @@ std::shared_ptr ParallelStep::execute(std::shared_ptr inputSamples void ParallelStep::executeRunnerThread_(ThreadInfo* threadState) { - int samplesIn = codec2_fifo_used(threadState->inputFifo); - int samplesOut = 0; - if (codec2_fifo_read(threadState->inputFifo, threadState->tempInput.get(), samplesIn) != 0) + int samplesIn = 0; + do { - 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); - if (samplesOut > 0) - { - codec2_fifo_write(threadState->outputFifo, output.get(), samplesOut); - } + auto output = threadState->step->execute(threadState->tempInput, samplesIn, &samplesOut); + if (samplesOut > 0) + { + codec2_fifo_write(threadState->outputFifo, output.get(), samplesOut); + } + } while (codec2_fifo_used(threadState->inputFifo) > 0); }