From fcba41e2e4752d6391c76ef4e2c9f0c8c5734159 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 21 Nov 2016 18:31:32 +0100 Subject: audio: fix --audio-stream-silence with ao_alsa ao_alsa.c calls this before the common code sets ao->sstride. Other than this, I'm still not sure whether this works. Seems like no, or depends. --- audio/out/push.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'audio') diff --git a/audio/out/push.c b/audio/out/push.c index 68606386f2..555a7867da 100644 --- a/audio/out/push.c +++ b/audio/out/push.c @@ -453,8 +453,9 @@ int ao_play_silence(struct ao *ao, int samples) assert(ao->api == &ao_api_push); if (samples <= 0 || !af_fmt_is_pcm(ao->format) || !ao->driver->play) return 0; - char *p = talloc_size(NULL, samples * ao->sstride); - af_fill_silence(p, samples * ao->sstride, ao->format); + int bytes = af_fmt_to_bytes(ao->format) * samples * ao->channels.num; + char *p = talloc_size(NULL, bytes); + af_fill_silence(p, bytes, ao->format); void *tmp[MP_NUM_CHANNELS]; for (int n = 0; n < MP_NUM_CHANNELS; n++) tmp[n] = p; -- cgit v1.2.3