From 0b42ec714dc836a2c7c37966df597a48eea2c291 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 1 Apr 2024 16:23:00 +0200 Subject: [PATCH] stream: handle node.name fallback better If we don't have extra properties, set the node.name to the stream name if it was not otherwise present. --- src/pipewire/filter.c | 10 ++++++---- src/pipewire/stream.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/pipewire/filter.c b/src/pipewire/filter.c index ef2b7c8d4..8459be42e 100644 --- a/src/pipewire/filter.c +++ b/src/pipewire/filter.c @@ -1255,10 +1255,12 @@ filter_new(struct pw_context *context, const char *name, spa_hook_list_init(&impl->hooks); this->properties = props; - if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL && extra) { - str = pw_properties_get(extra, PW_KEY_APP_NAME); - if (str == NULL) - str = pw_properties_get(extra, PW_KEY_APP_PROCESS_BINARY); + if ((str = pw_properties_get(props, PW_KEY_NODE_NAME)) == NULL) { + if (extra) { + str = pw_properties_get(extra, PW_KEY_APP_NAME); + if (str == NULL) + str = pw_properties_get(extra, PW_KEY_APP_PROCESS_BINARY); + } if (str == NULL) str = name; pw_properties_set(props, PW_KEY_NODE_NAME, str); diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index c5267221f..8e8595178 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -1544,10 +1544,12 @@ stream_new(struct pw_context *context, const char *name, if (pw_properties_get(props, PW_KEY_STREAM_IS_LIVE) == NULL) pw_properties_set(props, PW_KEY_STREAM_IS_LIVE, "true"); - if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL && extra) { - str = pw_properties_get(extra, PW_KEY_APP_NAME); - if (str == NULL) - str = pw_properties_get(extra, PW_KEY_APP_PROCESS_BINARY); + if ((str = pw_properties_get(props, PW_KEY_NODE_NAME)) == NULL) { + if (extra) { + str = pw_properties_get(extra, PW_KEY_APP_NAME); + if (str == NULL) + str = pw_properties_get(extra, PW_KEY_APP_PROCESS_BINARY); + } if (str == NULL) str = name; pw_properties_set(props, PW_KEY_NODE_NAME, str);