aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/portaudio.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/portaudio.c
parent98b2fa6cb523cab6702bfeee36e089711012b9d8 (diff)
Check the number of available samples before calling the capture method
Diffstat (limited to 'Alc/backends/portaudio.c')
-rw-r--r--Alc/backends/portaudio.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c
index 8070942c..4275ad80 100644
--- a/Alc/backends/portaudio.c
+++ b/Alc/backends/portaudio.c
@@ -377,20 +377,17 @@ static void pa_stop_capture(ALCdevice *device)
ERR("Error stopping stream: %s\n", Pa_GetErrorText(err));
}
-static ALCuint pa_available_samples(ALCdevice *device)
+static ALCenum pa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples)
{
pa_data *data = device->ExtraData;
- return RingBufferSize(data->ring);
+ ReadRingBuffer(data->ring, buffer, samples);
+ return ALC_NO_ERROR;
}
-static ALCenum pa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples)
+static ALCuint pa_available_samples(ALCdevice *device)
{
pa_data *data = device->ExtraData;
-
- if(pa_available_samples(device) < samples)
- return ALC_INVALID_VALUE;
- ReadRingBuffer(data->ring, buffer, samples);
- return ALC_NO_ERROR;
+ return RingBufferSize(data->ring);
}