From 74395b9976b397f0d29bea91c86fbd438c08e1f4 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Wed, 7 Jun 2023 14:37:29 +0100 Subject: [PATCH] Fix oversized final block tests for libsamplerate as well --- src/faster/StretcherProcess.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/faster/StretcherProcess.cpp b/src/faster/StretcherProcess.cpp index c9eb096..c77ffb7 100644 --- a/src/faster/StretcherProcess.cpp +++ b/src/faster/StretcherProcess.cpp @@ -175,8 +175,10 @@ R2Stretcher::consumeChannel(size_t c, Profiler profiler2("R2Stretcher::resample"); toWrite = int(ceil(samples / m_pitchScale)); + bool shortened = false; if (writable < toWrite) { samples = int(floor(writable * m_pitchScale)); + shortened = true; if (samples == 0) return 0; } @@ -213,7 +215,7 @@ R2Stretcher::consumeChannel(size_t c, &input, samples, 1.0 / m_pitchScale, - final); + final && !shortened); #if defined(STRETCHER_IMPL_RESAMPLER_MUTEX_REQUIRED) if (m_threaded) {