From ee61f7a55caabec6f9c1394ce84e343d940cab92 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 2 Aug 2010 17:24:40 -0700 Subject: Make sure to request a tlength that's at least minreq*2 And warn if Pulse returns a minreq that's too large --- Alc/pulseaudio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Alc') diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index 1fa16d7e..b5e6f4ab 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -326,8 +326,11 @@ static void stream_buffer_attr_callback(pa_stream *stream, void *pdata) //{{{ data->attr = *(ppa_stream_get_buffer_attr(stream)); Device->UpdateSize = data->attr.minreq / data->frame_size; Device->NumUpdates = (data->attr.tlength/data->frame_size) / Device->UpdateSize; - if(Device->NumUpdates == 0) + if(Device->NumUpdates <= 1) + { Device->NumUpdates = 1; + AL_PRINT("PulseAudio returned tlength < minreq*2; expect break up\n"); + } ProcessContext(NULL); }//}}} @@ -879,6 +882,8 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{ data->attr.fragsize = -1; data->attr.minreq = device->UpdateSize * data->frame_size; data->attr.tlength = data->attr.minreq * device->NumUpdates; + if(data->attr.tlength < data->attr.minreq*2) + data->attr.tlength = data->attr.minreq*2; data->attr.maxlength = data->attr.tlength; flags |= PA_STREAM_EARLY_REQUESTS; flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE; -- cgit v1.2.3