aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/opensl.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-10-08 21:52:08 -0700
committerChris Robinson <[email protected]>2019-10-08 21:55:03 -0700
commit963580c2d503eab7c6d8f60a367498ff103bfa3e (patch)
treeca30803987383fd8bbf413ee7fdd33898c97f2da /alc/backends/opensl.cpp
parent7726a06d26e59dc6a8e109af2e268de878c4f606 (diff)
Never return null from CreateRingBuffer
Allocation failure would already throw a bad_alloc anyway, now a size overflow throws an exception too.
Diffstat (limited to 'alc/backends/opensl.cpp')
-rw-r--r--alc/backends/opensl.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp
index 4e68da27..258443f2 100644
--- a/alc/backends/opensl.cpp
+++ b/alc/backends/opensl.cpp
@@ -521,14 +521,7 @@ bool OpenSLPlayback::reset()
if(SL_RESULT_SUCCESS == result)
{
const ALuint num_updates{mDevice->BufferSize / mDevice->UpdateSize};
- try {
- mRing = CreateRingBuffer(num_updates, mFrameSize*mDevice->UpdateSize, true);
- }
- catch(std::exception& e) {
- ERR("Failed allocating ring buffer %ux%ux%u: %s\n", mDevice->UpdateSize,
- num_updates, mFrameSize, e.what());
- result = SL_RESULT_MEMORY_FAILURE;
- }
+ mRing = CreateRingBuffer(num_updates, mFrameSize*mDevice->UpdateSize, true);
}
if(SL_RESULT_SUCCESS != result)
@@ -703,16 +696,10 @@ void OpenSLCapture::open(const ALCchar* name)
mDevice->Frequency/100*5)};
ALuint num_updates{(length+update_len-1) / update_len};
- try {
- mRing = CreateRingBuffer(num_updates, update_len*mFrameSize, false);
+ mRing = CreateRingBuffer(num_updates, update_len*mFrameSize, false);
- mDevice->UpdateSize = update_len;
- mDevice->BufferSize = static_cast<ALuint>(mRing->writeSpace() * update_len);
- }
- catch(std::exception& e) {
- ERR("Failed to allocate ring buffer: %s\n", e.what());
- result = SL_RESULT_MEMORY_FAILURE;
- }
+ mDevice->UpdateSize = update_len;
+ mDevice->BufferSize = static_cast<ALuint>(mRing->writeSpace() * update_len);
}
if(SL_RESULT_SUCCESS == result)
{