diff --git a/src/pipewire/buffers.c b/src/pipewire/buffers.c index d27b9ee24..3499805ee 100644 --- a/src/pipewire/buffers.c +++ b/src/pipewire/buffers.c @@ -255,6 +255,12 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags, struct port input = { innode, SPA_DIRECTION_INPUT, in_port_id }; int res; + if (flags & PW_BUFFERS_FLAG_IN_PRIORITY) { + struct port tmp = output; + output = input; + input = tmp; + } + res = param_filter(result, &input, &output, SPA_PARAM_Buffers, &b); if (res < 0) { pw_context_debug_port_params(context, input.node, input.direction, diff --git a/src/pipewire/buffers.h b/src/pipewire/buffers.h index df72bf3f8..abef3925f 100644 --- a/src/pipewire/buffers.h +++ b/src/pipewire/buffers.h @@ -48,6 +48,7 @@ extern "C" { #define PW_BUFFERS_FLAG_SHARED (1<<1) /**< buffers can be shared */ #define PW_BUFFERS_FLAG_DYNAMIC (1<<2) /**< buffers have dynamic data */ #define PW_BUFFERS_FLAG_SHARED_MEM (1<<3) /**< buffers need shared memory */ +#define PW_BUFFERS_FLAG_IN_PRIORITY (1<<4) /**< input parameters have priority */ struct pw_buffers { struct pw_memblock *mem; /**< allocated buffer memory */ diff --git a/src/pipewire/impl-link.c b/src/pipewire/impl-link.c index 012bced6c..5eeff5b01 100644 --- a/src/pipewire/impl-link.c +++ b/src/pipewire/impl-link.c @@ -517,6 +517,9 @@ static int do_allocation(struct pw_impl_link *this) if (output->node->remote || input->node->remote) alloc_flags |= PW_BUFFERS_FLAG_SHARED_MEM; + if (output->node->driver) + alloc_flags |= PW_BUFFERS_FLAG_IN_PRIORITY; + /* if output port can alloc buffers, alloc skeleton buffers */ if (SPA_FLAG_IS_SET(out_flags, SPA_PORT_FLAG_CAN_ALLOC_BUFFERS)) { SPA_FLAG_SET(alloc_flags, PW_BUFFERS_FLAG_NO_MEM);