diff options
author | Chris Robinson <[email protected]> | 2020-11-23 10:55:13 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-11-23 10:55:13 -0800 |
commit | d08d6b18c42b4346f82125fd645eb0835a58fe3b (patch) | |
tree | 2f6b963b0585d7d8042d6398f0b79f446cc75ca8 /alc/backends | |
parent | d062c16629a93e37366ab88d60d2df3372a234e2 (diff) |
Ceil the scaled buffer size instead of round
The result has to be large enough to get the original requested size from it.
Diffstat (limited to 'alc/backends')
-rw-r--r-- | alc/backends/coreaudio.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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 <stdlib.h> #include <string.h> +#include <cmath> + #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<uint64_t>(mDevice->BufferSize*srateScale + 0.5), + auto FrameCount64 = maxu64(static_cast<uint64_t>(std::ceil(mDevice->BufferSize*srateScale)), static_cast<UInt32>(outputFormat.mSampleRate)/10); FrameCount64 += MAX_RESAMPLER_PADDING; if(FrameCount64 > std::numeric_limits<int32_t>::max()) |