ao: do not allow actual buffer size of 0

You can use --audio-buffer=0 to minimize the audio buffer size. But if
the AO reports no device buffer size (like e.g. ao_jack does), then the
buffer size is actually 0, and playback can never work properly.

Make it fallback to a size of 1, which is unlikely to work properly, but
you get what you asked for, instead of a freeze.
This commit is contained in:
wm4 2018-03-07 22:58:47 +01:00 committed by Kevin Mitchell
parent 5f41fbb6d9
commit f40e0cb0f2
1 changed files with 1 additions and 0 deletions

View File

@ -232,6 +232,7 @@ static struct ao *ao_init(bool probing, struct mpv_global *global,
if (ao->device_buffer)
MP_VERBOSE(ao, "device buffer: %d samples.\n", ao->device_buffer);
ao->buffer = MPMAX(ao->device_buffer, ao->def_buffer * ao->samplerate);
ao->buffer = MPMAX(ao->buffer, 1);
int align = af_format_sample_alignment(ao->format);
ao->buffer = (ao->buffer + align - 1) / align * align;