From d75ea89cbeecfe317719e59c2e46509ff3f445e8 Mon Sep 17 00:00:00 2001 From: CrSjimo Date: Wed, 7 Feb 2024 00:47:22 +0800 Subject: [PATCH] fix bug in BufferingAudioSource --- src/core/source/BufferingAudioSource.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/source/BufferingAudioSource.cpp b/src/core/source/BufferingAudioSource.cpp index b2d023c..b98610d 100644 --- a/src/core/source/BufferingAudioSource.cpp +++ b/src/core/source/BufferingAudioSource.cpp @@ -311,8 +311,10 @@ namespace talcs { for (qint64 offset = 0; offset < length; offset += frameLength) { if (d->isTerminateRequested) return; - d->src->read(AudioSourceReadData(&d->buf, startPos + offset, qMin(frameLength, length - offset))); - d->tailPosition += qMin(frameLength, length - offset); + if (frameLength > length - offset) + break; + d->src->read(AudioSourceReadData(&d->buf, startPos + offset, frameLength)); + d->tailPosition += frameLength; } }