mirror of https://github.com/mpv-player/mpv
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:
parent
5f41fbb6d9
commit
f40e0cb0f2
|
@ -232,6 +232,7 @@ static struct ao *ao_init(bool probing, struct mpv_global *global,
|
||||||
if (ao->device_buffer)
|
if (ao->device_buffer)
|
||||||
MP_VERBOSE(ao, "device buffer: %d samples.\n", 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->device_buffer, ao->def_buffer * ao->samplerate);
|
||||||
|
ao->buffer = MPMAX(ao->buffer, 1);
|
||||||
|
|
||||||
int align = af_format_sample_alignment(ao->format);
|
int align = af_format_sample_alignment(ao->format);
|
||||||
ao->buffer = (ao->buffer + align - 1) / align * align;
|
ao->buffer = (ao->buffer + align - 1) / align * align;
|
||||||
|
|
Loading…
Reference in New Issue