From 969818db6fbadf2b3d42df63a9729f4476219d12 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 4 Jul 2010 16:27:42 -0700 Subject: Use a 100ms capture buffer minimum for PulseAudio, with 50ms fragments This better matches what is given with the WaveIn backend --- Alc/pulseaudio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index 594126cf..dabcbaf0 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -977,6 +977,8 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na data->samples = device->UpdateSize * device->NumUpdates; data->frame_size = aluFrameSizeFromFormat(device->Format); + if(data->samples < 100 * device->Frequency / 1000) + data->samples = 100 * device->Frequency / 1000; if(!(data->ring = CreateRingBuffer(data->frame_size, data->samples))) { @@ -986,10 +988,10 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na data->attr.minreq = -1; data->attr.prebuf = -1; - data->attr.maxlength = data->frame_size * data->samples; + data->attr.maxlength = data->samples * data->frame_size; data->attr.tlength = -1; - data->attr.fragsize = min(data->frame_size * data->samples, - 10 * device->Frequency / 1000); + data->attr.fragsize = min(data->samples, 50 * device->Frequency / 1000) * + data->frame_size; data->spec.rate = device->Frequency; data->spec.channels = aluChannelsFromFormat(device->Format); -- cgit v1.2.3