media-session: sanitize name and nick

Replace unwanted chars in the name with _. This makes it compatible
with pulseaudio names and avoids problems with regex.
Replace unwanred chars in the nick with ' '. This ensures JACK
clients don't receive ':' in the device names, which cause it to
fail when parsing the ports.

See #714 and #130
This commit is contained in:
Wim Taymans 2021-02-12 20:47:41 +01:00
parent ac910c7c1c
commit 062911640c
5 changed files with 55 additions and 10 deletions

View file

@ -133,6 +133,7 @@ static struct node *bluez5_create_node(struct device *device, uint32_t id,
int res;
const char *prefix, *str, *profile, *rules;
int priority;
char name[1024];
pw_log_debug("new node %u", id);
@ -175,7 +176,10 @@ static struct node *bluez5_create_node(struct device *device, uint32_t id,
else
prefix = info->factory_name;
pw_properties_setf(node->props, PW_KEY_NODE_NAME, "%s.%s.%s", prefix, str, profile);
pw_properties_set(node->props, PW_KEY_NODE_NAME,
sm_media_session_sanitize_name(name, sizeof(name),
'_', "%s.%s.%s", prefix, str, profile));
pw_properties_set(node->props, PW_KEY_FACTORY_NAME, info->factory_name);
if (pw_properties_get(node->props, PW_KEY_PRIORITY_DRIVER) == NULL) {