From cc3dd648ace1f1276e909dcb07adf782a39f1cf3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 18 Sep 2011 20:27:34 -0700 Subject: Check the number of available samples before calling the capture method --- Alc/backends/oss.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Alc/backends/oss.c') diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c index 79830c06..9206343b 100644 --- a/Alc/backends/oss.c +++ b/Alc/backends/oss.c @@ -461,19 +461,17 @@ static void oss_stop_capture(ALCdevice *pDevice) data->doCapture = 0; } -static ALCuint oss_available_samples(ALCdevice *pDevice) +static ALCenum oss_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples) { oss_data *data = (oss_data*)pDevice->ExtraData; - return RingBufferSize(data->ring); + ReadRingBuffer(data->ring, pBuffer, lSamples); + return ALC_NO_ERROR; } -static ALCenum oss_capture_samples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lSamples) +static ALCuint oss_available_samples(ALCdevice *pDevice) { oss_data *data = (oss_data*)pDevice->ExtraData; - if(oss_available_samples(pDevice) < lSamples) - return ALC_INVALID_VALUE; - ReadRingBuffer(data->ring, pBuffer, lSamples); - return ALC_NO_ERROR; + return RingBufferSize(data->ring); } -- cgit v1.2.3