From 3cb4116243e54b0452d88c70a7acd4af17cf8d02 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 10 Nov 2013 23:05:51 +0100 Subject: ao: add ao_play_silence, use for ao_alsa and ao_oss Also add a corresponding function to audio/format.c, which fills an audio block with silence. --- audio/out/ao_oss.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'audio/out/ao_oss.c') diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 556f3c25c9..db9847851d 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -508,16 +508,13 @@ static int play(struct ao *ao, void *data, int len, int flags) static void audio_resume(struct ao *ao) { struct priv *p = ao->priv; - int fillcnt; #ifndef SNDCTL_DSP_RESET reset(ao); #endif - fillcnt = get_space(ao) - p->prepause_space; - if (fillcnt > 0 && !(ao->format & AF_FORMAT_SPECIAL_MASK)) { - void *silence = calloc(fillcnt, 1); - play(ao, silence, fillcnt, 0); - free(silence); - } + int fillframes = (get_space(ao) - p->prepause_space) / + (af_fmt2bits(ao->format) / 8 * ao->channels.num); + if (fillframes > 0) + ao_play_silence(ao, fillframes); } // return: delay in seconds between first and last sample in buffer -- cgit v1.2.3