aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2018-03-07 22:58:47 +0100
committerGravatar Kevin Mitchell <kevmitch@gmail.com>2018-03-08 17:12:32 -0800
commitf40e0cb0f21f0f322cdb74eb7582f63986d7dab5 (patch)
tree5f1cd89d7ec16ca3840da17c77e37e7dd96319e5
parent5f41fbb6d931700d4bc7455ca7bf289d15d6d8eb (diff)
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.
-rw-r--r--audio/out/ao.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index 5834345d59..8f6fc8ea3c 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -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;