From 683e212a779341a7b376fbb6d5df54cb8205893d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 3 Oct 2013 23:38:19 +0200 Subject: [PATCH] ao_coreaudio: clear output buffer on buffer underrun Output silence to the output buffer during underruns. This removes small occasional glitches that happen before the AUHAL is actually paused from the `audio_pause` call. Fixes #269 --- audio/out/ao_coreaudio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index cba0900973..878d92b0af 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -112,6 +112,7 @@ static OSStatus render_cb_lpcm(void *ctx, AudioUnitRenderActionFlags *aflags, if (mp_ring_buffered(p->buffer) < requested) { MP_VERBOSE(ao, "buffer underrun\n"); audio_pause(ao); + memset(buf.mData, 0, requested); } else { mp_ring_read(p->buffer, buf.mData, requested); }