sad

simple audio daemon
git clone git://git.2f30.org/sad
Log | Files | Refs | LICENSE

commit 110bb7a949aa16a2fa78cafdd53ceafb14f16aae
parent c3741bbe5ed837bc24b6969f747c5183da95e553
Author: sin <sin@2f30.org>
Date:   Wed, 31 Dec 2014 18:31:03 +0000

Keep a copy of the buffer to simplify freeing resources

Should revisit all of this code at some point.

Diffstat:
Moutput.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/output.c b/output.c @@ -178,13 +178,17 @@ playoutput(Format *fmt, Outputdesc *desc, void *buf, size_t nbytes) return 0; /* perform mono to stereo conversion */ - inbuf = NULL; if (fmt->channels == 1 && desc->fmt.channels == 2) { inbuf = malloc(nbytes * 2); if (!inbuf) err(1, "malloc"); s16monotostereo(buf, buf, inbuf, nbytes / 2); nbytes *= 2; + } else { + inbuf = malloc(nbytes); + if (!inbuf) + err(1, "malloc"); + memcpy(inbuf, buf, nbytes); } if (desc->fmt.rate == fmt->rate) {