From 634cf1a5039189766ea488dbb209592559c4ad75 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 24 Feb 2021 10:13:36 +0100 Subject: [PATCH] Add patch for jack names --- ...z5-set-the-right-volumes-on-the-node.patch | 25 +++ ...ck-handle-client-init-error-with-EIO.patch | 25 +++ ...-PIPEWIRE_PROPS-after-reading-config.patch | 67 ++++++++ ...g-option-to-shorten-and-filter-names.patch | 159 ++++++++++++++++++ 0046-jack-fix-names-of-our-ports.patch | 43 +++++ pipewire.spec | 26 ++- 6 files changed, 336 insertions(+), 9 deletions(-) create mode 100644 0010-bluez5-set-the-right-volumes-on-the-node.patch create mode 100644 0021-jack-handle-client-init-error-with-EIO.patch create mode 100644 0027-jack-apply-PIPEWIRE_PROPS-after-reading-config.patch create mode 100644 0038-jack-add-config-option-to-shorten-and-filter-names.patch create mode 100644 0046-jack-fix-names-of-our-ports.patch diff --git a/0010-bluez5-set-the-right-volumes-on-the-node.patch b/0010-bluez5-set-the-right-volumes-on-the-node.patch new file mode 100644 index 0000000..77d244c --- /dev/null +++ b/0010-bluez5-set-the-right-volumes-on-the-node.patch @@ -0,0 +1,25 @@ +From 930b411075a5c1b0d9ddcfe7dd2dbfdc27baab90 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Thu, 18 Feb 2021 19:25:04 +0100 +Subject: [PATCH 10/46] bluez5: set the right volumes on the node + +--- + spa/plugins/bluez5/bluez5-device.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c +index be7064941..ea9930f76 100644 +--- a/spa/plugins/bluez5/bluez5-device.c ++++ b/spa/plugins/bluez5/bluez5-device.c +@@ -942,7 +942,7 @@ static int node_set_volume(struct impl *this, struct node *node, float volumes[] + spa_pod_builder_add_object(&b, + SPA_TYPE_OBJECT_Props, SPA_EVENT_DEVICE_Props, + SPA_PROP_channelVolumes, SPA_POD_Array(sizeof(float), +- SPA_TYPE_Float, n_volumes, volumes), ++ SPA_TYPE_Float, node->n_channels, node->volumes), + SPA_PROP_channelMap, SPA_POD_Array(sizeof(uint32_t), + SPA_TYPE_Id, node->n_channels, node->channels)); + event = spa_pod_builder_pop(&b, &f[0]); +-- +2.26.2 + diff --git a/0021-jack-handle-client-init-error-with-EIO.patch b/0021-jack-handle-client-init-error-with-EIO.patch new file mode 100644 index 0000000..8b6331a --- /dev/null +++ b/0021-jack-handle-client-init-error-with-EIO.patch @@ -0,0 +1,25 @@ +From 715a3a642a4f1c1f624e0a9dc0394b1819b69f93 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Fri, 19 Feb 2021 16:10:10 +0100 +Subject: [PATCH 21/46] jack: handle client init error with -EIO + +--- + spa/plugins/jack/jack-client.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/spa/plugins/jack/jack-client.c b/spa/plugins/jack/jack-client.c +index 8f28eb923..b3cdcc7f2 100644 +--- a/spa/plugins/jack/jack-client.c ++++ b/spa/plugins/jack/jack-client.c +@@ -63,6 +63,8 @@ static int status_to_result(jack_status_t status) + res = -ECONNREFUSED; + else if (status & JackVersionError) + res = -EPROTO; ++ else if (status & JackInitFailure) ++ res = -EIO; + else + res = -EFAULT; + +-- +2.26.2 + diff --git a/0027-jack-apply-PIPEWIRE_PROPS-after-reading-config.patch b/0027-jack-apply-PIPEWIRE_PROPS-after-reading-config.patch new file mode 100644 index 0000000..2c52902 --- /dev/null +++ b/0027-jack-apply-PIPEWIRE_PROPS-after-reading-config.patch @@ -0,0 +1,67 @@ +From 149319819aa5d4e39770c35a0c00f6c2963e2bf3 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Sat, 20 Feb 2021 21:02:05 +0100 +Subject: [PATCH 27/46] jack: apply PIPEWIRE_PROPS after reading config + +First apply config properties, then PIPEWIRE_PROPS. +We can set the node.latency in jack.conf +--- + pipewire-jack/src/pipewire-jack.c | 20 ++++++++++---------- + src/daemon/jack.conf.in | 1 + + 2 files changed, 11 insertions(+), 10 deletions(-) + +diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c +index 3bf0af1c8..90895e476 100644 +--- a/pipewire-jack/src/pipewire-jack.c ++++ b/pipewire-jack/src/pipewire-jack.c +@@ -2421,19 +2421,16 @@ jack_client_t * jack_client_open (const char *client_name, + varargs_parse(client, options, ap); + va_end(ap); + +- if ((str = getenv("PIPEWIRE_PROPS")) != NULL) +- client->props = pw_properties_new_string(str); +- if (client->props == NULL) +- client->props = pw_properties_new(NULL, NULL); ++ client->props = pw_properties_new( ++ "loop.cancel", "true", ++ PW_KEY_REMOTE_NAME, client->server_name, ++ PW_KEY_CLIENT_NAME, client_name, ++ PW_KEY_CLIENT_API, "jack", ++ PW_KEY_CONFIG_NAME, "jack.conf", ++ NULL); + if (client->props == NULL) + goto no_props; + +- pw_properties_set(client->props, "loop.cancel", "true"); +- pw_properties_set(client->props, PW_KEY_REMOTE_NAME, client->server_name); +- pw_properties_set(client->props, PW_KEY_CLIENT_NAME, client_name); +- pw_properties_set(client->props, PW_KEY_CLIENT_API, "jack"); +- pw_properties_set(client->props, PW_KEY_CONFIG_NAME, "jack.conf"); +- + client->node_id = SPA_ID_INVALID; + strncpy(client->name, client_name, JACK_CLIENT_NAME_SIZE); + client->context.loop = pw_thread_loop_new(client_name, NULL); +@@ -2452,6 +2449,9 @@ jack_client_t * jack_client_open (const char *client_name, + "jack.properties")) != NULL) + pw_properties_update_string(client->props, str, strlen(str)); + ++ if ((str = getenv("PIPEWIRE_PROPS")) != NULL) ++ pw_properties_update_string(client->props, str, strlen(str)); ++ + if ((str = pw_properties_get(client->props, "jack.merge-monitor")) != NULL) + client->merge_monitor = pw_properties_parse_bool(str); + +diff --git a/src/daemon/jack.conf.in b/src/daemon/jack.conf.in +index dec2d5c71..2ef4877ad 100644 +--- a/src/daemon/jack.conf.in ++++ b/src/daemon/jack.conf.in +@@ -54,5 +54,6 @@ context.modules = { + } + + jack.properties = { ++ #node.latency = 1024/48000 + #jack.merge-monitor = false + } +-- +2.26.2 + diff --git a/0038-jack-add-config-option-to-shorten-and-filter-names.patch b/0038-jack-add-config-option-to-shorten-and-filter-names.patch new file mode 100644 index 0000000..fc69e94 --- /dev/null +++ b/0038-jack-add-config-option-to-shorten-and-filter-names.patch @@ -0,0 +1,159 @@ +From d54da879bf5f9fa9009e1ab27e8d52eae3141764 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Tue, 23 Feb 2021 16:13:08 +0100 +Subject: [PATCH 38/46] jack: add config option to shorten and filter names + +--- + pipewire-jack/src/pipewire-jack.c | 66 +++++++++++++++++++++++++------ + src/daemon/jack.conf.in | 2 + + 2 files changed, 55 insertions(+), 13 deletions(-) + +diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c +index 90895e476..755bc9934 100644 +--- a/pipewire-jack/src/pipewire-jack.c ++++ b/pipewire-jack/src/pipewire-jack.c +@@ -352,6 +352,8 @@ struct client { + unsigned int timeowner_pending:1; + unsigned int timeowner_conditional:1; + unsigned int merge_monitor:1; ++ unsigned int short_name:1; ++ unsigned int filter_name:1; + + jack_position_t jack_position; + jack_transport_state_t jack_state; +@@ -2078,6 +2080,18 @@ static const struct pw_metadata_events metadata_events = { + .property = metadata_property + }; + ++#define FILTER_NAME " ()[].:*$" ++#define FILTER_PORT " ()[].*$" ++ ++static void filter_name(char *str, const char *filter) ++{ ++ char *p; ++ for (p = str; *p; p++) { ++ if (strchr(filter, *p) != NULL) ++ *p = ' '; ++ } ++} ++ + static void registry_event_global(void *data, uint32_t id, + uint32_t permissions, const char *type, uint32_t version, + const struct spa_dict *props) +@@ -2093,6 +2107,7 @@ static void registry_event_global(void *data, uint32_t id, + + if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) { + const char *app, *node_name; ++ char tmp[JACK_CLIENT_NAME_SIZE+1]; + + o = alloc_object(c); + object_type = INTERFACE_Node; +@@ -2113,19 +2128,34 @@ static void registry_event_global(void *data, uint32_t id, + if ((str = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS)) != NULL) + o->node.is_bridge = strstr(str, "Bridge") != NULL; + +- if ((str = spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION)) == NULL && +- (str = spa_dict_lookup(props, PW_KEY_NODE_NICK)) == NULL && +- (str = node_name) == NULL) { +- str = "node"; ++ if (c->short_name) { ++ str = spa_dict_lookup(props, PW_KEY_NODE_NICK); ++ if (str == NULL) ++ str = spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION); ++ } else { ++ str = spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION); ++ if (str == NULL) ++ str = spa_dict_lookup(props, PW_KEY_NODE_NICK); + } ++ if (str == NULL) ++ str = node_name; ++ if (str == NULL) ++ str = "node"; ++ + if (app && strcmp(app, str) != 0) +- snprintf(o->node.name, sizeof(o->node.name), "%s/%s", app, str); ++ snprintf(tmp, sizeof(tmp), "%s/%s", app, str); + else +- snprintf(o->node.name, sizeof(o->node.name), "%s", str); ++ snprintf(tmp, sizeof(tmp), "%s", str); ++ ++ if (c->filter_name) ++ filter_name(tmp, FILTER_NAME); + +- ot = find_node(c, o->node.name); ++ ot = find_node(c, tmp); + if (ot != NULL && o->node.client_id != ot->node.client_id) +- snprintf(o->node.name, sizeof(o->node.name), "%s-%d", str, id); ++ snprintf(o->node.name, sizeof(o->node.name), "%.*s-%d", ++ (int)(sizeof(tmp)-11), tmp, id); ++ else ++ snprintf(o->node.name, sizeof(o->node.name), "%s", tmp); + + if ((str = spa_dict_lookup(props, PW_KEY_PRIORITY_DRIVER)) != NULL) + o->node.priority = pw_properties_parse_int(str); +@@ -2143,6 +2173,7 @@ static void registry_event_global(void *data, uint32_t id, + uint32_t node_id; + char full_name[1024]; + bool is_monitor = false; ++ char tmp[REAL_JACK_PORT_NAME_SIZE+1]; + + object_type = INTERFACE_Port; + if ((str = spa_dict_lookup(props, PW_KEY_FORMAT_DSP)) == NULL) +@@ -2207,11 +2238,14 @@ static void registry_event_global(void *data, uint32_t id, + goto exit_free; + + if (ot->node.is_bridge && strchr(str, ':') != NULL) +- snprintf(o->port.name, sizeof(o->port.name), "%s", str); ++ snprintf(tmp, sizeof(tmp), "%s", str); + else if (is_monitor && !c->merge_monitor) +- snprintf(o->port.name, sizeof(o->port.name), "%s Monitor:%s", ot->node.name, str); ++ snprintf(tmp, sizeof(tmp), "%s Monitor:%s", ot->node.name, str); + else +- snprintf(o->port.name, sizeof(o->port.name), "%s:%s", ot->node.name, str); ++ snprintf(tmp, sizeof(tmp), "%s:%s", ot->node.name, str); ++ ++ if (c->filter_name) ++ filter_name(tmp, FILTER_PORT); + + o->port.port_id = SPA_ID_INVALID; + o->port.priority = ot->node.priority; +@@ -2233,10 +2267,12 @@ static void registry_event_global(void *data, uint32_t id, + o->port.node_id = node_id; + o->port.is_monitor = is_monitor; + +- op = find_port(c, o->port.name); ++ op = find_port(c, tmp); + if (op != NULL && op != o) + snprintf(o->port.name, sizeof(o->port.name), "%.*s-%d", +- (int)(sizeof(op->port.name)-11), op->port.name, id); ++ (int)(sizeof(tmp)-11), tmp, id); ++ else ++ snprintf(o->port.name, sizeof(o->port.name), "%s", tmp); + + pw_log_debug(NAME" %p: add port %d name:%s %d", c, id, + o->port.name, type_id); +@@ -2454,6 +2490,10 @@ jack_client_t * jack_client_open (const char *client_name, + + if ((str = pw_properties_get(client->props, "jack.merge-monitor")) != NULL) + client->merge_monitor = pw_properties_parse_bool(str); ++ if ((str = pw_properties_get(client->props, "jack.short-name")) != NULL) ++ client->short_name = pw_properties_parse_bool(str); ++ if ((str = pw_properties_get(client->props, "jack.filter-name")) != NULL) ++ client->filter_name = pw_properties_parse_bool(str); + + spa_list_init(&client->context.free_objects); + pthread_mutex_init(&client->context.lock, NULL); +diff --git a/src/daemon/jack.conf.in b/src/daemon/jack.conf.in +index 2ef4877ad..02c8b7c76 100644 +--- a/src/daemon/jack.conf.in ++++ b/src/daemon/jack.conf.in +@@ -56,4 +56,6 @@ context.modules = { + jack.properties = { + #node.latency = 1024/48000 + #jack.merge-monitor = false ++ #jack.short-name = false ++ #jack.filter-name = false + } +-- +2.26.2 + diff --git a/0046-jack-fix-names-of-our-ports.patch b/0046-jack-fix-names-of-our-ports.patch new file mode 100644 index 0000000..ee8197b --- /dev/null +++ b/0046-jack-fix-names-of-our-ports.patch @@ -0,0 +1,43 @@ +From e340a44a357e4550e169bc8825c6aa8b4ceb76db Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Tue, 23 Feb 2021 21:11:05 +0100 +Subject: [PATCH 46/46] jack: fix names of our ports + +Write our port name into the port.name + +See #796 +See #780 +See #569 +--- + pipewire-jack/src/pipewire-jack.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c +index 755bc9934..51f8d3942 100644 +--- a/pipewire-jack/src/pipewire-jack.c ++++ b/pipewire-jack/src/pipewire-jack.c +@@ -2171,7 +2171,6 @@ static void registry_event_global(void *data, uint32_t id, + unsigned long flags = 0; + jack_port_type_id_t type_id; + uint32_t node_id; +- char full_name[1024]; + bool is_monitor = false; + char tmp[REAL_JACK_PORT_NAME_SIZE+1]; + +@@ -2219,10 +2218,10 @@ static void registry_event_global(void *data, uint32_t id, + + o = NULL; + if (node_id == c->node_id) { +- snprintf(full_name, sizeof(full_name), "%s:%s", c->name, str); +- o = find_port(c, full_name); ++ snprintf(tmp, sizeof(tmp), "%s:%s", c->name, str); ++ o = find_port(c, tmp); + if (o != NULL) +- pw_log_debug(NAME" %p: %s found our port %p", c, full_name, o); ++ pw_log_debug(NAME" %p: %s found our port %p", c, tmp, o); + } + if (o == NULL) { + o = alloc_object(c); +-- +2.26.2 + diff --git a/pipewire.spec b/pipewire.spec index da5615a..f807054 100644 --- a/pipewire.spec +++ b/pipewire.spec @@ -8,7 +8,7 @@ %global libversion %{soversion}.%(bash -c '((intversion = (%{minorversion} * 100) + %{microversion})); echo ${intversion}').0 # For rpmdev-bumpspec and releng automation -%global baserelease 5 +%global baserelease 6 #global snapdate 20210107 #global gitcommit b17db2cebc1a5ab2c01851d29c05f79cd2f262bb @@ -56,14 +56,19 @@ Patch0: 0001-bluez5-include-a2dp-codec-profiles-in-route-profiles.patch Patch1: 0005-fix-some-warnings.patch Patch2: 0006-spa-escape-double-quotes.patch Patch3: 0009-bluez5-volumes-need-to-be-distributed-to-all-channel.patch -Patch4: 0011-bluez5-backend-native-Check-volume-values.patch -Patch5: 0012-media-session-don-t-switch-to-pro-audio-by-default.patch -Patch6: 0013-audioconvert-keep-better-track-of-param-changes.patch -Patch7: 0018-pulse-server-print-encoding-name-in-format_info.patch -Patch8: 0019-pulse-server-handle-unsupported-formats.patch -Patch9: 0022-pw-cli-always-output-to-stdout.patch -Patch10: 0024-policy-node-don-t-crash-without-metadata.patch -Patch11: 0025-bluez5-route-shouldn-t-list-a2dp-profiles-when-not-c.patch +Patch4: 0010-bluez5-set-the-right-volumes-on-the-node.patch +Patch5: 0011-bluez5-backend-native-Check-volume-values.patch +Patch6: 0012-media-session-don-t-switch-to-pro-audio-by-default.patch +Patch7: 0013-audioconvert-keep-better-track-of-param-changes.patch +Patch8: 0018-pulse-server-print-encoding-name-in-format_info.patch +Patch9: 0019-pulse-server-handle-unsupported-formats.patch +Patch10: 0021-jack-handle-client-init-error-with-EIO.patch +Patch11: 0022-pw-cli-always-output-to-stdout.patch +Patch12: 0024-policy-node-don-t-crash-without-metadata.patch +Patch13: 0025-bluez5-route-shouldn-t-list-a2dp-profiles-when-not-c.patch +Patch14: 0027-jack-apply-PIPEWIRE_PROPS-after-reading-config.patch +Patch15: 0038-jack-add-config-option-to-shorten-and-filter-names.patch +Patch16: 0046-jack-fix-names-of-our-ports.patch ## upstreamable patches @@ -447,6 +452,9 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || : %endif %changelog +* Wed Feb 24 2021 Wim Taymans - 0.3.22-6 +- Add patch for jack names + * Mon Feb 22 2021 Wim Taymans - 0.3.22-5 - Add some critical patches