diff --git a/src/pipeline/ExternVocoderStep.cpp b/src/pipeline/ExternVocoderStep.cpp index 6ec02770..6b1a9bc0 100644 --- a/src/pipeline/ExternVocoderStep.cpp +++ b/src/pipeline/ExternVocoderStep.cpp @@ -95,8 +95,6 @@ int ExternVocoderStep::getOutputSampleRate() const std::shared_ptr ExternVocoderStep::execute(std::shared_ptr inputSamples, int numInputSamples, int* numOutputSamples) { - const int MAX_OUTPUT_SAMPLES = 1024; - *numOutputSamples = 0; short* outputSamples = nullptr; @@ -104,6 +102,12 @@ std::shared_ptr ExternVocoderStep::execute(std::shared_ptr inputSa if (numInputSamples > 0) { codec2_fifo_write(inputSampleFifo_, inputSamples.get(), numInputSamples); +#ifdef _WIN32 + // XXX: simulate required processing time as actual I/O is handled + // by another thread. For some reason this is only needed on Windows. + int timeToSleep = (numInputSamples * 1000 / getInputSampleRate()) >> 2; + if (timeToSleep > 0) Sleep(timeToSleep); +#endif // _WIN32 } // Read and return output samples from thread.