mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
b39a7fddb5
commit
fcba41e2e4
|
@ -453,8 +453,9 @@ int ao_play_silence(struct ao *ao, int samples)
|
||||||
assert(ao->api == &ao_api_push);
|
assert(ao->api == &ao_api_push);
|
||||||
if (samples <= 0 || !af_fmt_is_pcm(ao->format) || !ao->driver->play)
|
if (samples <= 0 || !af_fmt_is_pcm(ao->format) || !ao->driver->play)
|
||||||
return 0;
|
return 0;
|
||||||
char *p = talloc_size(NULL, samples * ao->sstride);
|
int bytes = af_fmt_to_bytes(ao->format) * samples * ao->channels.num;
|
||||||
af_fill_silence(p, samples * ao->sstride, ao->format);
|
char *p = talloc_size(NULL, bytes);
|
||||||
|
af_fill_silence(p, bytes, ao->format);
|
||||||
void *tmp[MP_NUM_CHANNELS];
|
void *tmp[MP_NUM_CHANNELS];
|
||||||
for (int n = 0; n < MP_NUM_CHANNELS; n++)
|
for (int n = 0; n < MP_NUM_CHANNELS; n++)
|
||||||
tmp[n] = p;
|
tmp[n] = p;
|
||||||
|
|
Loading…
Reference in New Issue