aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/coreaudio.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-18 20:27:34 -0700
committerChris Robinson <[email protected]>2011-09-18 20:27:34 -0700
commitcc3dd648ace1f1276e909dcb07adf782a39f1cf3 (patch)
treeb23d5bb282553f028d96795320d2f5b5b10de5fe /Alc/backends/coreaudio.c
parent98b2fa6cb523cab6702bfeee36e089711012b9d8 (diff)
Check the number of available samples before calling the capture method
Diffstat (limited to 'Alc/backends/coreaudio.c')
-rw-r--r--Alc/backends/coreaudio.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c
index 2d9ab7a8..7ac43325 100644
--- a/Alc/backends/coreaudio.c
+++ b/Alc/backends/coreaudio.c
@@ -630,12 +630,6 @@ static void ca_stop_capture(ALCdevice *device)
ERR("AudioOutputUnitStop failed\n");
}
-static ALCuint ca_available_samples(ALCdevice *device)
-{
- ca_data *data = device->ExtraData;
- return RingBufferSize(data->ring) / data->sampleRateRatio;
-}
-
static ALCenum ca_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples)
{
ca_data *data = (ca_data*)device->ExtraData;
@@ -643,9 +637,6 @@ static ALCenum ca_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint sa
UInt32 frameCount;
OSStatus err;
- if(ca_available_samples(device) < samples)
- return ALC_INVALID_VALUE;
-
// If no samples are requested, just return
if(samples == 0)
return ALC_NO_ERROR;
@@ -671,6 +662,12 @@ static ALCenum ca_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint sa
return ALC_NO_ERROR;
}
+static ALCuint ca_available_samples(ALCdevice *device)
+{
+ ca_data *data = device->ExtraData;
+ return RingBufferSize(data->ring) / data->sampleRateRatio;
+}
+
static const BackendFuncs ca_funcs = {
ca_open_playback,