From f3661672782008ea54e29a577d9143bd0c370d11 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 3 Apr 2024 15:27:05 +0200 Subject: [PATCH] settings: remove link.min-buffers option again The min should always be 1. We have other ways of bumping the number of buffers to 2, like the ASYNC allocation flag which we can set if we are also doing some async scheduling. We could make this an option later. Otherwise, we would also allocate 2 buffers by default between the mixer and the node, which is unnecessary. --- doc/dox/config/pipewire.conf.5.md | 4 ---- src/daemon/minimal.conf.in | 1 - src/daemon/pipewire.conf.in | 1 - src/pipewire/buffers.c | 1 - src/pipewire/impl-link.c | 3 +++ src/pipewire/private.h | 1 - src/pipewire/settings.c | 5 +---- 7 files changed, 4 insertions(+), 12 deletions(-) diff --git a/doc/dox/config/pipewire.conf.5.md b/doc/dox/config/pipewire.conf.5.md index 3542f19be..4a143cc6c 100644 --- a/doc/dox/config/pipewire.conf.5.md +++ b/doc/dox/config/pipewire.conf.5.md @@ -217,10 +217,6 @@ Default video rate denominator @PAR@ pipewire.conf library.name.system = support/libspa-support The name of the shared library to use for the system functions for the main thread. -@PAR@ pipewire.conf link.min-buffers = 2 -The minimum number of buffers to negotiate between nodes. Using 1 buffer will consume -less memory but might cause glitches when using async nodes. - @PAR@ pipewire.conf link.max-buffers = 64 The maximum number of buffers to negotiate between nodes. Note that version < 3 clients can only support 16 buffers. More buffers is almost always worse than less, latency diff --git a/src/daemon/minimal.conf.in b/src/daemon/minimal.conf.in index b108fe580..15ef3dbb1 100644 --- a/src/daemon/minimal.conf.in +++ b/src/daemon/minimal.conf.in @@ -13,7 +13,6 @@ context.properties = { #library.name.system = support/libspa-support #context.data-loop.library.name.system = support/libspa-support #support.dbus = true - #link.min-buffers = 2 #link.max-buffers = 64 link.max-buffers = 16 # version < 3 clients can't handle more #mem.warn-mlock = false diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in index da527615f..e6e216281 100644 --- a/src/daemon/pipewire.conf.in +++ b/src/daemon/pipewire.conf.in @@ -13,7 +13,6 @@ context.properties = { #library.name.system = support/libspa-support #context.data-loop.library.name.system = support/libspa-support #support.dbus = true - #link.min-buffers = 2 #link.max-buffers = 64 link.max-buffers = 16 # version < 3 clients can't handle more #mem.warn-mlock = false diff --git a/src/pipewire/buffers.c b/src/pipewire/buffers.c index 90b4bf3c1..5f6912441 100644 --- a/src/pipewire/buffers.c +++ b/src/pipewire/buffers.c @@ -308,7 +308,6 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags, if (SPA_FLAG_IS_SET(flags, PW_BUFFERS_FLAG_ASYNC)) max_buffers = SPA_MAX(2u, max_buffers); - max_buffers = SPA_MAX(context->settings.link_min_buffers, max_buffers); if (SPA_FLAG_IS_SET(flags, PW_BUFFERS_FLAG_SHARED_MEM)) { if (types != SPA_ID_INVALID) diff --git a/src/pipewire/impl-link.c b/src/pipewire/impl-link.c index 081e9e1d7..d6e6717fe 100644 --- a/src/pipewire/impl-link.c +++ b/src/pipewire/impl-link.c @@ -588,6 +588,9 @@ static int do_allocation(struct pw_impl_link *this) flags = 0; /* always shared buffers for the link */ alloc_flags = PW_BUFFERS_FLAG_SHARED; + /* always enable async mode */ + alloc_flags |= PW_BUFFERS_FLAG_ASYNC; + if (output->node->remote || input->node->remote) alloc_flags |= PW_BUFFERS_FLAG_SHARED_MEM; diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 936a2e736..0a6c75501 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -46,7 +46,6 @@ struct settings { uint32_t clock_quantum_floor; /* quantum floor (lower bound) */ struct spa_rectangle video_size; struct spa_fraction video_rate; - uint32_t link_min_buffers; uint32_t link_max_buffers; unsigned int mem_warn_mlock:1; unsigned int mem_allow_mlock:1; diff --git a/src/pipewire/settings.c b/src/pipewire/settings.c index 95f961686..350efc690 100644 --- a/src/pipewire/settings.c +++ b/src/pipewire/settings.c @@ -32,7 +32,6 @@ #define DEFAULT_VIDEO_HEIGHT 480 #define DEFAULT_VIDEO_RATE_NUM 25u #define DEFAULT_VIDEO_RATE_DENOM 1u -#define DEFAULT_LINK_MIN_BUFFERS 2u #define DEFAULT_LINK_MAX_BUFFERS 64u #define DEFAULT_MEM_WARN_MLOCK false #define DEFAULT_MEM_ALLOW_MLOCK true @@ -223,7 +222,6 @@ void pw_settings_init(struct pw_context *this) d->log_level = get_default_int(p, "log.level", pw_log_level); d->clock_power_of_two_quantum = get_default_bool(p, "clock.power-of-two-quantum", DEFAULT_CLOCK_POWER_OF_TWO_QUANTUM); - d->link_min_buffers = get_default_int(p, "link.min-buffers", DEFAULT_LINK_MIN_BUFFERS); d->link_max_buffers = get_default_int(p, "link.max-buffers", DEFAULT_LINK_MAX_BUFFERS); d->mem_warn_mlock = get_default_bool(p, "mem.warn-mlock", DEFAULT_MEM_WARN_MLOCK); d->mem_allow_mlock = get_default_bool(p, "mem.allow-mlock", DEFAULT_MEM_ALLOW_MLOCK); @@ -231,8 +229,7 @@ void pw_settings_init(struct pw_context *this) d->check_quantum = get_default_bool(p, "settings.check-quantum", DEFAULT_CHECK_QUANTUM); d->check_rate = get_default_bool(p, "settings.check-rate", DEFAULT_CHECK_RATE); - d->link_min_buffers = SPA_MAX(d->link_min_buffers, 1u); - d->link_max_buffers = SPA_MAX(d->link_max_buffers, d->link_min_buffers); + d->link_max_buffers = SPA_MAX(d->link_max_buffers, 1u); d->clock_quantum_limit = SPA_CLAMP(d->clock_quantum_limit, CLOCK_QUANTUM_FLOOR, CLOCK_QUANTUM_LIMIT);