diff --git a/src/modules/module-autolink.c b/src/modules/module-autolink.c index 2a9a11d7b..241afbd22 100644 --- a/src/modules/module-autolink.c +++ b/src/modules/module-autolink.c @@ -148,15 +148,24 @@ static void try_link_controls(struct impl *impl, struct pw_port *port, struct pw struct pw_control *cin, *cout; int res; + pw_log_debug("module %p: trying controls", impl); spa_list_for_each(cout, &port->control_list[SPA_DIRECTION_OUTPUT], port_link) { spa_list_for_each(cin, &target->control_list[SPA_DIRECTION_INPUT], port_link) { - pw_log_debug("controls %d <-> %d", cin->id, cout->id); - if (cin->id == cout->id) { + if (cin->prop_id == cout->prop_id) { if ((res = pw_control_link(cout, cin)) < 0) pw_log_error("failed to link controls: %s", spa_strerror(res)); } } } + spa_list_for_each(cin, &port->control_list[SPA_DIRECTION_INPUT], port_link) { + spa_list_for_each(cout, &target->control_list[SPA_DIRECTION_OUTPUT], port_link) { + if (cin->prop_id == cout->prop_id) { + if ((res = pw_control_link(cout, cin)) < 0) + pw_log_error("failed to link controls: %s", spa_strerror(res)); + } + } + } + } diff --git a/src/pipewire/control.c b/src/pipewire/control.c index 2e5a09f86..eee463d7b 100644 --- a/src/pipewire/control.c +++ b/src/pipewire/control.c @@ -50,10 +50,11 @@ pw_control_new(struct pw_core *core, if (spa_pod_object_parse(param, ":", t->param_io.id, "I", &this->id, - ":", t->param_io.size, "i", &this->size) < 0) + ":", t->param_io.size, "i", &this->size, + ":", t->param.propId, "I", &this->prop_id) < 0) goto exit_free; - pw_log_debug("control %p: new %s %d", this, spa_type_map_get_type(t->map, this->id), direction); + pw_log_debug("control %p: new %s %d", this, spa_type_map_get_type(t->map, this->prop_id), direction); this->core = core; this->port = port; @@ -78,7 +79,6 @@ pw_control_new(struct pw_core *core, exit_free: free(impl); exit: - pw_log_error("control failed"); return NULL; } @@ -154,7 +154,8 @@ int pw_control_link(struct pw_control *control, struct pw_control *other) impl = SPA_CONTAINER_OF(control, struct impl, this); - pw_log_debug("control %p: link to %p", control, other); + pw_log_debug("control %p: link to %p %s", control, other, + spa_type_map_get_type(control->core->type.map, control->prop_id)); if (impl->mem == NULL) { if ((res = pw_memblock_alloc(PW_MEMBLOCK_FLAG_WITH_FD | @@ -224,7 +225,7 @@ int pw_control_unlink(struct pw_control *control, struct pw_control *other) if ((res = spa_node_port_set_io(port->node->node, port->direction, port->port_id, control->id, NULL, 0)) < 0) { - goto exit; + pw_log_warn("control %p: can't unset port control io", control); } } @@ -233,13 +234,12 @@ int pw_control_unlink(struct pw_control *control, struct pw_control *other) if ((res = spa_node_port_set_io(port->node->node, port->direction, port->port_id, other->id, NULL, 0)) < 0) { - goto exit; + pw_log_warn("control %p: can't unset port control io", control); } } spa_hook_list_call(&control->listener_list, struct pw_control_events, unlinked, other); spa_hook_list_call(&other->listener_list, struct pw_control_events, unlinked, control); - exit: return res; } diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 1e920004b..6b227abe1 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -424,6 +424,7 @@ struct pw_control { struct spa_list inputs_link; /**< link in linked input control */ uint32_t id; + uint32_t prop_id; int32_t size; struct spa_hook_list listener_list;