From 9ba8b921cfb3e461958656a2e2d7c1c6c2abb677 Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Wed, 10 Jun 2020 17:45:43 +0200 Subject: [PATCH] ao/jack: set device_buffer to JACK buffer size This change sets the device_buffer member of the ao struct for the JACK ao to whatever value we read during init. While JACK allows changing the audio buffer size on-the-fly (you can do this for example through DBus), having it somehow reconfigure the entire audio buffer logic of mpv that depends on device_buffer in some way when that happens only leads to audio dropout and weird code. device_buffer's role is mostly for prebuffer from what I understand, which means that simply setting it to its current value in the init function is fine. --- audio/out/ao_jack.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audio/out/ao_jack.c b/audio/out/ao_jack.c index 0901fec36b..f55974b1e8 100644 --- a/audio/out/ao_jack.c +++ b/audio/out/ao_jack.c @@ -246,6 +246,8 @@ static int init(struct ao *ao) jack_set_process_callback(p->client, process, ao); ao->samplerate = jack_get_sample_rate(p->client); + // The actual device buffer can change, but this is enough for pre-buffer + ao->device_buffer = jack_get_buffer_size(p->client); jack_set_buffer_size_callback(p->client, buffer_size_cb, ao); jack_set_graph_order_callback(p->client, graph_order_cb, ao);