From 5a29fbf1a616a3116a1e9d8d2ec2888ccbe88342 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Mon, 30 May 2011 15:24:34 -0700 Subject: [PATCH] simpleaudio fix pulse read return --- src/simpleaudio-pulse.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/simpleaudio-pulse.c b/src/simpleaudio-pulse.c index f677d14..ca8894d 100644 --- a/src/simpleaudio-pulse.c +++ b/src/simpleaudio-pulse.c @@ -22,12 +22,13 @@ sa_pulse_read( simpleaudio *sa, float *buf, size_t nframes ) int error; pa_simple *s = (pa_simple *)sa->backend_handle; size_t nbytes = nframes * sa->backend_framesize; - int n; - if ((n = pa_simple_read(s, buf, nbytes, &error)) < 0) { + /* N.B. pa_simple_read always returns 0 or -1, not the number of + * read bytes!*/ + if (pa_simple_read(s, buf, nbytes, &error) < 0) { fprintf(stderr, "pa_simple_read: %s\n", pa_strerror(error)); return -1; } - return n; + return nframes; }