From d08d6b18c42b4346f82125fd645eb0835a58fe3b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 23 Nov 2020 10:55:13 -0800 Subject: [PATCH] Ceil the scaled buffer size instead of round The result has to be large enough to get the original requested size from it. --- alc/backends/coreaudio.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index 60a2c00a..9f674389 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "alcmain.h" #include "alexcpt.h" #include "alu.h" @@ -553,7 +555,7 @@ void CoreAudioCapture::open(const ALCchar *name) * conversion ring buffer. Ensure at least 100ms for the total buffer. */ double srateScale{double{outputFormat.mSampleRate} / mDevice->Frequency}; - auto FrameCount64 = maxu64(static_cast(mDevice->BufferSize*srateScale + 0.5), + auto FrameCount64 = maxu64(static_cast(std::ceil(mDevice->BufferSize*srateScale)), static_cast(outputFormat.mSampleRate)/10); FrameCount64 += MAX_RESAMPLER_PADDING; if(FrameCount64 > std::numeric_limits::max())