audioconvert: mark ports and buffers as DYNAMIC

Only passthrough buffer data when the buffer and ports are
marked as DYNAMIC.
Use extra buffer for nodes that keep a ref on buffers (resample).
This commit is contained in:
Wim Taymans 2019-03-21 10:45:24 +01:00
parent df5c81e3be
commit 036ca89c0e
11 changed files with 81 additions and 39 deletions

View file

@ -165,7 +165,9 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
SPA_PORT_CHANGE_MASK_PROPS |
SPA_PORT_CHANGE_MASK_PARAMS;
port->info = SPA_PORT_INFO_INIT();
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
SPA_PORT_FLAG_NO_REF |
SPA_PORT_FLAG_DYNAMIC_DATA;
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
@ -792,6 +794,9 @@ impl_node_port_use_buffers(struct spa_node *node,
this, j, i);
}
b->datas[j] = d[j].data;
if (direction == SPA_DIRECTION_OUTPUT &&
!SPA_FLAG_CHECK(d[j].flags, SPA_DATA_FLAG_DYNAMIC))
this->is_passthrough = false;
}
if (direction == SPA_DIRECTION_OUTPUT)
@ -1099,7 +1104,8 @@ impl_init(const struct spa_handle_factory *factory,
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
SPA_PORT_CHANGE_MASK_PARAMS;
port->info = SPA_PORT_INFO_INIT();
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS;
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
SPA_PORT_FLAG_DYNAMIC_DATA;
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
port->params[1] = SPA_PARAM_INFO(SPA_PARAM_Meta, SPA_PARAM_INFO_READ);
port->params[2] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);