mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-26 07:58:03 -04:00
clean up port's io struct when node is paused
This commit is contained in:
parent
14dd77578a
commit
48fae6fa3e
2 changed files with 15 additions and 1 deletions
|
|
@ -1571,6 +1571,8 @@ int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
|||
int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct impl *impl = (struct impl*)object;
|
||||
struct port *port;
|
||||
struct spa_io_buffers *io;
|
||||
int res;
|
||||
|
||||
spa_return_val_if_fail(impl != nullptr, -EINVAL);
|
||||
|
|
@ -1593,6 +1595,12 @@ int impl_node_send_command(void *object, const struct spa_command *command)
|
|||
case SPA_NODE_COMMAND_Pause:
|
||||
case SPA_NODE_COMMAND_Suspend:
|
||||
spa_libcamera_stream_off(impl);
|
||||
port = GET_OUT_PORT(impl, 0);
|
||||
io = port->io;
|
||||
if (io && (io->buffer_id < port->n_buffers)) {
|
||||
spa_libcamera_buffer_recycle(impl, port, io->buffer_id);
|
||||
io->buffer_id = SPA_ID_INVALID;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
|
|||
{
|
||||
struct impl *this = object;
|
||||
struct port *port;
|
||||
struct spa_io_buffers *io;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(command != NULL, -EINVAL);
|
||||
|
|
@ -389,6 +390,11 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
|
|||
return 0;
|
||||
this->started = false;
|
||||
set_timer(this, false);
|
||||
io = port->io;
|
||||
if (io && (io->buffer_id < port->n_buffers)) {
|
||||
reuse_buffer(this, port, io->buffer_id);
|
||||
io->buffer_id = SPA_ID_INVALID;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
|
|
@ -527,7 +533,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
|
||||
result.id = id;
|
||||
result.next = start;
|
||||
next:
|
||||
next:
|
||||
result.index = result.next++;
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue