From 81f1a6c511f80b24df02f5bd2197853d5480bd10 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 3 Jan 2022 13:00:15 +0100 Subject: [PATCH] module-loopback: make unique media name per stream If not otherwise set, the media.name will be the name used when pw_stream_new(), which is the same for all loopback streams. This makes the session manager restore the same volume for all loopback streams. Do something more clever and use the node.name + suffix to make the name unique per stream if no media.name was given. Fixes #1942 --- src/modules/module-loopback.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index 4622244c7..271abd70b 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -485,6 +485,16 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) parse_audio_info(impl->capture_props, &impl->capture_info); parse_audio_info(impl->playback_props, &impl->playback_info); + if (pw_properties_get(impl->capture_props, PW_KEY_MEDIA_NAME) == NULL) + pw_properties_setf(impl->capture_props, PW_KEY_MEDIA_NAME, + "%s.loopback-capture", + pw_properties_get(impl->capture_props, PW_KEY_NODE_NAME)); + + if (pw_properties_get(impl->playback_props, PW_KEY_MEDIA_NAME) == NULL) + pw_properties_setf(impl->playback_props, PW_KEY_MEDIA_NAME, + "%s.loopback-playback", + pw_properties_get(impl->playback_props, PW_KEY_NODE_NAME)); + impl->core = pw_context_get_object(impl->context, PW_TYPE_INTERFACE_Core); if (impl->core == NULL) { str = pw_properties_get(props, PW_KEY_REMOTE_NAME);