aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-26 08:55:22 -0700
committerChris Robinson <[email protected]>2017-06-26 08:55:22 -0700
commit740e7d979c10d798a01d446c9262fce1d83041a6 (patch)
treecbc0e7b3305a930ea759c61ef0a76f7257fda63e
parent464a7c054569f1b206d0ecce1e049658b24b682f (diff)
Convert all input samples in the loop
Instead of potentially leaving 1 sample that requires another loop iteration.
-rw-r--r--Alc/converter.c4
1 files 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++)