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.
This commit is contained in:
Nicolas F 2020-06-10 17:45:43 +02:00 committed by sfan5
parent 68276e2672
commit 9ba8b921cf
1 changed files with 2 additions and 0 deletions

View File

@ -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);