summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2023-03-20 21:41:28 +0000
committerPhilip Langdale <github.philipl@overt.org>2023-04-23 21:03:58 -0700
commitcb6b4af1d7711e31b1a58d3771f779fbd5079351 (patch)
tree48acf09cc96c2cecf4a752e3711a28c84fcace7b
parenteafd0e5fad06bbd6972aa30b98755dedcd1f6773 (diff)
downloadmpv-cb6b4af1d7711e31b1a58d3771f779fbd5079351.tar.bz2
mpv-cb6b4af1d7711e31b1a58d3771f779fbd5079351.tar.xz
ao_pipewire: let sound server determine latency
Fixes #11467
-rw-r--r--audio/out/ao_pipewire.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c
index 6ce01a10ab..0c2b311771 100644
--- a/audio/out/ao_pipewire.c
+++ b/audio/out/ao_pipewire.c
@@ -567,9 +567,12 @@ static int init(struct ao *ao)
if (pipewire_init_boilerplate(ao) < 0)
goto error_props;
- ao->device_buffer = p->options.buffer_msec * ao->samplerate / 1000;
+ if (p->options.buffer_msec) {
+ ao->device_buffer = p->options.buffer_msec * ao->samplerate / 1000;
+
+ pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%d/%d", ao->device_buffer, ao->samplerate);
+ }
- pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%d/%d", ao->device_buffer, ao->samplerate);
pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%d", ao->samplerate);
enum spa_audio_format spa_format = af_fmt_to_pw(ao, ao->format);
@@ -886,7 +889,8 @@ const struct ao_driver audio_out_pipewire = {
},
.options_prefix = "pipewire",
.options = (const struct m_option[]) {
- {"buffer", OPT_INT(options.buffer_msec), M_RANGE(1, 2000)},
+ {"buffer", OPT_CHOICE(options.buffer_msec, {"native", 0}),
+ M_RANGE(1, 2000)},
{"remote", OPT_STRING(options.remote) },
{"volume-mode", OPT_CHOICE(options.volume_mode,
{"channel", VOLUME_MODE_CHANNEL}, {"global", VOLUME_MODE_GLOBAL})},