mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-14 06:59:57 -05:00
buffers: add new ASYNC flag
Make sure we allocate at least 2 buffers when we are dealing with an ASYNC node. This ensures that an adapter without a converter will at least negotiate to 2 buffers when the follower stream is async (such as is the case with pw-cat).
This commit is contained in:
parent
b3940627dd
commit
d3bd687bc2
3 changed files with 10 additions and 2 deletions
|
|
@ -292,6 +292,9 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
|
||||||
align = SPA_MAX(align, qalign);
|
align = SPA_MAX(align, qalign);
|
||||||
types = qtypes;
|
types = qtypes;
|
||||||
|
|
||||||
|
if (SPA_FLAG_IS_SET(flags, PW_BUFFERS_FLAG_ASYNC))
|
||||||
|
max_buffers = SPA_MAX(2u, max_buffers);
|
||||||
|
|
||||||
pw_log_debug("%p: %d %d %d %d %d %d -> %d %zd %zd %d %zd %d", result,
|
pw_log_debug("%p: %d %d %d %d %d %d -> %d %zd %zd %d %zd %d", result,
|
||||||
qblocks, qminsize, qstride, qmax_buffers, qalign, qtypes,
|
qblocks, qminsize, qstride, qmax_buffers, qalign, qtypes,
|
||||||
blocks, minsize, stride, max_buffers, align, types);
|
blocks, minsize, stride, max_buffers, align, types);
|
||||||
|
|
@ -300,6 +303,7 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
|
||||||
minsize = 8192;
|
minsize = 8192;
|
||||||
max_buffers = 2;
|
max_buffers = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
SPA_FLAG_CLEAR(types, 1<<SPA_DATA_MemPtr);
|
SPA_FLAG_CLEAR(types, 1<<SPA_DATA_MemPtr);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ extern "C" {
|
||||||
#define PW_BUFFERS_FLAG_DYNAMIC (1<<2) /**< buffers have dynamic data */
|
#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_SHARED_MEM (1<<3) /**< buffers need shared memory */
|
||||||
#define PW_BUFFERS_FLAG_IN_PRIORITY (1<<4) /**< input parameters have priority */
|
#define PW_BUFFERS_FLAG_IN_PRIORITY (1<<4) /**< input parameters have priority */
|
||||||
|
#define PW_BUFFERS_FLAG_ASYNC (1<<5) /**< one of the nodes is async */
|
||||||
|
|
||||||
struct pw_buffers {
|
struct pw_buffers {
|
||||||
struct pw_memblock *mem; /**< allocated buffer memory */
|
struct pw_memblock *mem; /**< allocated buffer memory */
|
||||||
|
|
|
||||||
|
|
@ -1574,9 +1574,12 @@ static int negotiate_mixer_buffers(struct pw_impl_port *port, uint32_t flags,
|
||||||
|
|
||||||
/* try dynamic data */
|
/* try dynamic data */
|
||||||
alloc_flags = PW_BUFFERS_FLAG_DYNAMIC;
|
alloc_flags = PW_BUFFERS_FLAG_DYNAMIC;
|
||||||
|
if (SPA_FLAG_IS_SET(node->spa_flags, SPA_NODE_FLAG_ASYNC))
|
||||||
|
alloc_flags |= PW_BUFFERS_FLAG_ASYNC;
|
||||||
|
|
||||||
pw_log_debug("%p: %d.%d negotiate %d buffers on node: %p",
|
pw_log_debug("%p: %d.%d negotiate %d buffers on node: %p flags:%08x",
|
||||||
port, port->direction, port->port_id, n_buffers, node->node);
|
port, port->direction, port->port_id, n_buffers, node->node,
|
||||||
|
alloc_flags);
|
||||||
|
|
||||||
if (port->added) {
|
if (port->added) {
|
||||||
pw_loop_invoke(node->data_loop, do_remove_port, SPA_ID_INVALID, NULL, 0, true, port);
|
pw_loop_invoke(node->data_loop, do_remove_port, SPA_ID_INVALID, NULL, 0, true, port);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue