aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/alsa.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/alsa.c
parent98b2fa6cb523cab6702bfeee36e089711012b9d8 (diff)
Check the number of available samples before calling the capture method
Diffstat (limited to 'Alc/backends/alsa.c')
-rw-r--r--Alc/backends/alsa.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index d953f52f..6d4528c1 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -979,6 +979,13 @@ static void alsa_stop_capture(ALCdevice *Device)
data->doCapture = AL_FALSE;
}
+static ALCenum alsa_capture_samples(ALCdevice *Device, ALCvoid *Buffer, ALCuint Samples)
+{
+ alsa_data *data = (alsa_data*)Device->ExtraData;
+ ReadRingBuffer(data->ring, Buffer, Samples);
+ return ALC_NO_ERROR;
+}
+
static ALCuint alsa_available_samples(ALCdevice *Device)
{
alsa_data *data = (alsa_data*)Device->ExtraData;
@@ -1040,16 +1047,6 @@ static ALCuint alsa_available_samples(ALCdevice *Device)
return RingBufferSize(data->ring);
}
-static ALCenum alsa_capture_samples(ALCdevice *Device, ALCvoid *Buffer, ALCuint Samples)
-{
- alsa_data *data = (alsa_data*)Device->ExtraData;
-
- if(alsa_available_samples(Device) < Samples)
- return ALC_INVALID_VALUE;
- ReadRingBuffer(data->ring, Buffer, Samples);
- return ALC_NO_ERROR;
-}
-
static const BackendFuncs alsa_funcs = {
alsa_open_playback,