diff options
author | Chris Robinson <[email protected]> | 2011-09-18 20:27:34 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-09-18 20:27:34 -0700 |
commit | cc3dd648ace1f1276e909dcb07adf782a39f1cf3 (patch) | |
tree | b23d5bb282553f028d96795320d2f5b5b10de5fe /Alc/backends/pulseaudio.c | |
parent | 98b2fa6cb523cab6702bfeee36e089711012b9d8 (diff) |
Check the number of available samples before calling the capture method
Diffstat (limited to 'Alc/backends/pulseaudio.c')
-rw-r--r-- | Alc/backends/pulseaudio.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index 2382a708..f727b639 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -1266,6 +1266,13 @@ static void pulse_stop_capture(ALCdevice *device) //{{{ pa_threaded_mainloop_unlock(data->loop); } //}}} +static ALCenum pulse_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples) //{{{ +{ + pulse_data *data = device->ExtraData; + ReadRingBuffer(data->ring, buffer, samples); + return ALC_NO_ERROR; +} //}}} + static ALCuint pulse_available_samples(ALCdevice *device) //{{{ { pulse_data *data = device->ExtraData; @@ -1297,16 +1304,6 @@ static ALCuint pulse_available_samples(ALCdevice *device) //{{{ return RingBufferSize(data->ring); } //}}} -static ALCenum pulse_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples) //{{{ -{ - pulse_data *data = device->ExtraData; - - if(pulse_available_samples(device) < samples) - return ALC_INVALID_VALUE; - ReadRingBuffer(data->ring, buffer, samples); - return ALC_NO_ERROR; -} //}}} - static const BackendFuncs pulse_funcs = { //{{{ pulse_open_playback, |