From bd518ed26463bc83f975712275d7af0b69ec897d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 24 Jan 2010 00:03:23 -0800 Subject: Make sure all requested data gets written to PulseAudio --- Alc/pulseaudio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Alc/pulseaudio.c') diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index 69d80703..dbc29b90 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -421,22 +421,24 @@ static void stream_write_callback(pa_stream *stream, size_t len, void *pdata) // pulse_data *data = Device->ExtraData; len -= len%data->attr.minreq; - if(len > 0) + while(len > 0) { + size_t newlen = len; void *buf; pa_free_cb_t free_func = NULL; #if PA_CHECK_VERSION(0,9,16) if(!ppa_stream_begin_write || - ppa_stream_begin_write(stream, &buf, &len) < 0) + ppa_stream_begin_write(stream, &buf, &newlen) < 0) #endif { - buf = ppa_xmalloc(len); + buf = ppa_xmalloc(newlen); free_func = ppa_xfree; } - aluMixData(Device, buf, len/data->frame_size); - ppa_stream_write(stream, buf, len, free_func, 0, PA_SEEK_RELATIVE); + aluMixData(Device, buf, newlen/data->frame_size); + ppa_stream_write(stream, buf, newlen, free_func, 0, PA_SEEK_RELATIVE); + len -= newlen; } } //}}} //}}} -- cgit v1.2.3