From 740e7d979c10d798a01d446c9262fce1d83041a6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 26 Jun 2017 08:55:22 -0700 Subject: Convert all input samples in the loop Instead of potentially leaving 1 sample that requires another loop iteration. --- Alc/converter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Alc/converter.c b/Alc/converter.c index 558f5e40..20789135 100644 --- a/Alc/converter.c +++ b/Alc/converter.c @@ -219,7 +219,7 @@ ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframe DataSize64 -= DataPosFrac; /* If we have a full prep, we can generate at least one sample. */ - return (ALsizei)clampu64(DataSize64/increment, 1, INT_MAX); + return (ALsizei)clampu64((DataSize64 + increment-1)/increment, 1, BUFFERSIZE); } @@ -283,7 +283,7 @@ ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALs DataSize64 -= DataPosFrac; /* If we have a full prep, we can generate at least one sample. */ - DstSize = (ALsizei)clampu64(DataSize64/increment, 1, BUFFERSIZE); + DstSize = (ALsizei)clampu64((DataSize64 + increment-1)/increment, 1, BUFFERSIZE); DstSize = mini(DstSize, dstframes-pos); for(chan = 0;chan < converter->mNumChannels;chan++) -- cgit v1.2.3