diff --git a/src/modules/module-audio-dsp/audio-dsp.c b/src/modules/module-audio-dsp/audio-dsp.c index b539695c5..86d4cd160 100644 --- a/src/modules/module-audio-dsp/audio-dsp.c +++ b/src/modules/module-audio-dsp/audio-dsp.c @@ -171,6 +171,7 @@ static void node_port_init(void *data, struct pw_port *port) void *iface; const struct spa_support *support; uint32_t n_support; + char position[8]; direction = pw_port_get_direction(port); if (direction == n->direction) @@ -184,16 +185,22 @@ static void node_port_init(void *data, struct pw_port *port) "port.terminal", "1", NULL); - if ((str = pw_properties_get(old, "port.channel")) != NULL) - pw_properties_setf(new, "port.name", "%s_%s", - direction == PW_DIRECTION_INPUT ? "playback" : "capture", - str); + if ((str = pw_properties_get(old, "port.channel")) == NULL || + strcmp(str, "UNK") == 0) { + snprintf(position, 7, "%d", port->port_id); + str = position; + } + + + pw_properties_setf(new, "port.name", "%s_%s", + direction == PW_DIRECTION_INPUT ? "playback" : "capture", + str); pw_properties_setf(new, "port.alias1", "%s_pcm:%s:%s%s", pw_properties_get(n->props, "device.api"), pw_properties_get(n->props, "device.name"), direction == PW_DIRECTION_INPUT ? "in" : "out", - str ? str : "UNK"); + str); pw_port_update_properties(port, &new->dict); pw_properties_free(new); diff --git a/src/pipewire/port.c b/src/pipewire/port.c index f5bda402a..c7df0f083 100644 --- a/src/pipewire/port.c +++ b/src/pipewire/port.c @@ -535,7 +535,8 @@ int pw_port_add(struct pw_port *port, struct pw_node *node) } if ((str = pw_properties_get(port->properties, "port.name")) == NULL) { - if ((str = pw_properties_get(port->properties, "port.channel")) != NULL) { + if ((str = pw_properties_get(port->properties, "port.channel")) != NULL && + strcmp(str, "UNK") != 0) { pw_properties_setf(port->properties, "port.name", "%s_%s", dir, str); } else {