diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 6729acbc4..ac6b4cccc 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -1239,15 +1239,16 @@ static void node_free(void *data) static int port_init_mix(void *data, struct pw_port_mix *mix) { struct impl *impl = data; - uint32_t ioid; - ioid = pw_map_insert_new(&impl->io_map, NULL); + mix->id = pw_map_insert_new(&impl->io_map, NULL); - mix->port.io = SPA_MEMBER(impl->io_areas->ptr, ioid * sizeof(struct spa_io_buffers), void); + mix->port.io = SPA_MEMBER(impl->io_areas->ptr, + mix->id * sizeof(struct spa_io_buffers), void); mix->port.io->buffer_id = SPA_ID_INVALID; mix->port.io->status = SPA_STATUS_NEED_BUFFER; - pw_log_debug("client-node %p: init mix io %d %p", impl, ioid, mix->port.io); + pw_log_debug("client-node %p: init mix io %d %p %p", impl, mix->id, mix->port.io, + impl->io_areas->ptr); return 0; } @@ -1255,11 +1256,11 @@ static int port_init_mix(void *data, struct pw_port_mix *mix) static int port_release_mix(void *data, struct pw_port_mix *mix) { struct impl *impl = data; - uint32_t id; - id = (mix->port.io - (struct spa_io_buffers*)impl->io_areas->ptr); + pw_log_debug("client-node %p: remove mix io %d %p %p", impl, mix->id, mix->port.io, + impl->io_areas->ptr); - pw_map_remove(&impl->io_map, id); + pw_map_remove(&impl->io_map, mix->id); return 0; } diff --git a/src/pipewire/private.h b/src/pipewire/private.h index f9864b07e..7de2a9a26 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -291,6 +291,7 @@ struct pw_port_mix { struct spa_graph_port port; struct spa_buffer **buffers; uint32_t n_buffers; + uint32_t id; }; struct pw_port_implementation {