From b59ff48156ebeed43dbd98478af67ef3de0ecab2 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Fri, 26 Jun 2020 19:38:18 +0300 Subject: [PATCH] si-convert: improve node properties for convert nodes * do not copy the full alsa node properties set * use a node description that makes the nodes look better in JACK * use . instead of / as a separator for the node.name, like elsewhere * add audio.convert spa lib association in the tests that use si-convert; previously it used to work because library.name was present in the properties copied from the adapter (and it so happens that the adapter lives in the audioconvert spa plugin as well ...) --- modules/module-si-convert.c | 20 ++++++++++++++------ tests/modules/config-endpoint.c | 2 ++ tests/modules/config-policy.c | 2 ++ tests/modules/si-audio-softdsp-endpoint.c | 2 ++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/modules/module-si-convert.c b/modules/module-si-convert.c index 6bfc17bf..919a88ab 100644 --- a/modules/module-si-convert.c +++ b/modules/module-si-convert.c @@ -269,16 +269,24 @@ si_convert_activate_execute_step (WpSessionItem * item, /* Create the convert properties based on the adapter properties */ node_props = wp_proxy_get_properties (WP_PROXY (node)); - props = wp_properties_copy (node_props); + props = wp_properties_new ( + PW_KEY_MEDIA_CLASS, "Audio/Convert", + PW_KEY_FACTORY_NAME, SPA_NAME_AUDIO_CONVERT, + /* make it a driver, so that it activates when linked */ + PW_KEY_NODE_DRIVER, "true", + /* the default mode is 'split', which breaks audio in this case */ + "factory.mode", "convert", + NULL); wp_properties_setf (props, PW_KEY_OBJECT_PATH, "%s:%s", - wp_properties_get(props, PW_KEY_OBJECT_PATH), + wp_properties_get (node_props, PW_KEY_OBJECT_PATH), self->name); - wp_properties_setf (props, PW_KEY_NODE_NAME, "%s/%s/%s", + wp_properties_setf (props, PW_KEY_NODE_NAME, "%s.%s.%s", SPA_NAME_AUDIO_CONVERT, - wp_properties_get(props, PW_KEY_NODE_NAME), + wp_properties_get (node_props, PW_KEY_NODE_NAME), self->name); - wp_properties_set (props, PW_KEY_MEDIA_CLASS, "Audio/Convert"); - wp_properties_set (props, PW_KEY_FACTORY_NAME, SPA_NAME_AUDIO_CONVERT); + wp_properties_setf (props, PW_KEY_NODE_DESCRIPTION, + "Stream volume for %s: %s", + wp_properties_get (node_props, PW_KEY_NODE_DESCRIPTION), self->name); /* Create the node */ self->node = wp_node_new_from_factory (core, "spa-node-factory", diff --git a/tests/modules/config-endpoint.c b/tests/modules/config-endpoint.c index 62b8ff0b..c2b70a5b 100644 --- a/tests/modules/config-endpoint.c +++ b/tests/modules/config-endpoint.c @@ -24,6 +24,8 @@ config_endpoint_setup (TestConfigEndpointFixture *f, gconstpointer data) g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context, "audiotestsrc", "audiotestsrc/libspa-audiotestsrc"), ==, 0); + g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context, + "audio.convert", "audioconvert/libspa-audioconvert"), ==, 0); g_assert_nonnull (pw_context_load_module (f->base.server.context, "libpipewire-module-spa-node-factory", NULL, NULL)); g_assert_nonnull (pw_context_load_module (f->base.server.context, diff --git a/tests/modules/config-policy.c b/tests/modules/config-policy.c index 5c33117e..9e8dbb1f 100644 --- a/tests/modules/config-policy.c +++ b/tests/modules/config-policy.c @@ -165,6 +165,8 @@ config_policy_setup (TestFixture *f, gconstpointer user_data) "fake*", "test/libspa-test"), ==, 0); g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context, "audiotestsrc", "audiotestsrc/libspa-audiotestsrc"), ==, 0); + g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context, + "audio.convert", "audioconvert/libspa-audioconvert"), ==, 0); g_assert_nonnull (pw_context_load_module (f->base.server.context, "libpipewire-module-spa-node-factory", NULL, NULL)); g_assert_nonnull (pw_context_load_module (f->base.server.context, diff --git a/tests/modules/si-audio-softdsp-endpoint.c b/tests/modules/si-audio-softdsp-endpoint.c index fd955a80..00218781 100644 --- a/tests/modules/si-audio-softdsp-endpoint.c +++ b/tests/modules/si-audio-softdsp-endpoint.c @@ -26,6 +26,8 @@ test_si_audio_softdsp_endpoint_setup (TestFixture * f, gconstpointer user_data) "fake*", "test/libspa-test"), ==, 0); g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context, "audiotestsrc", "audiotestsrc/libspa-audiotestsrc"), ==, 0); + g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context, + "audio.convert", "audioconvert/libspa-audioconvert"), ==, 0); g_assert_nonnull (pw_context_load_module (f->base.server.context, "libpipewire-module-spa-node-factory", NULL, NULL)); g_assert_nonnull (pw_context_load_module (f->base.server.context,