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.
This commit is contained in:
Wim Taymans 2024-04-03 15:27:05 +02:00
parent dbedd09d42
commit f366167278
7 changed files with 4 additions and 12 deletions

View file

@ -217,10 +217,6 @@ Default video rate denominator
@PAR@ pipewire.conf library.name.system = support/libspa-support @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. 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 @PAR@ pipewire.conf link.max-buffers = 64
The maximum number of buffers to negotiate between nodes. Note that version < 3 clients 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 can only support 16 buffers. More buffers is almost always worse than less, latency

View file

@ -13,7 +13,6 @@ context.properties = {
#library.name.system = support/libspa-support #library.name.system = support/libspa-support
#context.data-loop.library.name.system = support/libspa-support #context.data-loop.library.name.system = support/libspa-support
#support.dbus = true #support.dbus = true
#link.min-buffers = 2
#link.max-buffers = 64 #link.max-buffers = 64
link.max-buffers = 16 # version < 3 clients can't handle more link.max-buffers = 16 # version < 3 clients can't handle more
#mem.warn-mlock = false #mem.warn-mlock = false

View file

@ -13,7 +13,6 @@ context.properties = {
#library.name.system = support/libspa-support #library.name.system = support/libspa-support
#context.data-loop.library.name.system = support/libspa-support #context.data-loop.library.name.system = support/libspa-support
#support.dbus = true #support.dbus = true
#link.min-buffers = 2
#link.max-buffers = 64 #link.max-buffers = 64
link.max-buffers = 16 # version < 3 clients can't handle more link.max-buffers = 16 # version < 3 clients can't handle more
#mem.warn-mlock = false #mem.warn-mlock = false

View file

@ -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)) if (SPA_FLAG_IS_SET(flags, PW_BUFFERS_FLAG_ASYNC))
max_buffers = SPA_MAX(2u, max_buffers); 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 (SPA_FLAG_IS_SET(flags, PW_BUFFERS_FLAG_SHARED_MEM)) {
if (types != SPA_ID_INVALID) if (types != SPA_ID_INVALID)

View file

@ -588,6 +588,9 @@ static int do_allocation(struct pw_impl_link *this)
flags = 0; flags = 0;
/* always shared buffers for the link */ /* always shared buffers for the link */
alloc_flags = PW_BUFFERS_FLAG_SHARED; alloc_flags = PW_BUFFERS_FLAG_SHARED;
/* always enable async mode */
alloc_flags |= PW_BUFFERS_FLAG_ASYNC;
if (output->node->remote || input->node->remote) if (output->node->remote || input->node->remote)
alloc_flags |= PW_BUFFERS_FLAG_SHARED_MEM; alloc_flags |= PW_BUFFERS_FLAG_SHARED_MEM;

View file

@ -46,7 +46,6 @@ struct settings {
uint32_t clock_quantum_floor; /* quantum floor (lower bound) */ uint32_t clock_quantum_floor; /* quantum floor (lower bound) */
struct spa_rectangle video_size; struct spa_rectangle video_size;
struct spa_fraction video_rate; struct spa_fraction video_rate;
uint32_t link_min_buffers;
uint32_t link_max_buffers; uint32_t link_max_buffers;
unsigned int mem_warn_mlock:1; unsigned int mem_warn_mlock:1;
unsigned int mem_allow_mlock:1; unsigned int mem_allow_mlock:1;

View file

@ -32,7 +32,6 @@
#define DEFAULT_VIDEO_HEIGHT 480 #define DEFAULT_VIDEO_HEIGHT 480
#define DEFAULT_VIDEO_RATE_NUM 25u #define DEFAULT_VIDEO_RATE_NUM 25u
#define DEFAULT_VIDEO_RATE_DENOM 1u #define DEFAULT_VIDEO_RATE_DENOM 1u
#define DEFAULT_LINK_MIN_BUFFERS 2u
#define DEFAULT_LINK_MAX_BUFFERS 64u #define DEFAULT_LINK_MAX_BUFFERS 64u
#define DEFAULT_MEM_WARN_MLOCK false #define DEFAULT_MEM_WARN_MLOCK false
#define DEFAULT_MEM_ALLOW_MLOCK true #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->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", d->clock_power_of_two_quantum = get_default_bool(p, "clock.power-of-two-quantum",
DEFAULT_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->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_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); 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_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->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, 1u);
d->link_max_buffers = SPA_MAX(d->link_max_buffers, d->link_min_buffers);
d->clock_quantum_limit = SPA_CLAMP(d->clock_quantum_limit, d->clock_quantum_limit = SPA_CLAMP(d->clock_quantum_limit,
CLOCK_QUANTUM_FLOOR, CLOCK_QUANTUM_LIMIT); CLOCK_QUANTUM_FLOOR, CLOCK_QUANTUM_LIMIT);