Commit a4ad76a7 authored by Matteo Fortini's avatar Matteo Fortini Committed by Gautier Pelloux-Prayer

pulseaudio.c: fix output stuttering due to underflows

parent 66ad948e
......@@ -349,11 +349,17 @@ static void stream_free(Stream *s) {
}
static size_t stream_play(Stream *s, size_t nbytes) {
if (nbytes == 0) return 0;
size_t avail;
if (ms_bufferizer_get_avail(&s->bufferizer) >= nbytes){
if (nbytes == 0)
return 0;
avail = ms_bufferizer_get_avail(&s->bufferizer);
if (avail > 0) {
uint8_t *data;
int buffer_size;
if (nbytes > avail)
nbytes = avail;
data = ms_new(uint8_t, nbytes);
ms_mutex_lock(&s->mutex);
ms_bufferizer_read(&s->bufferizer, data, nbytes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment