From 67142e715ecacbf1c94c4d6f8000ef113c1e7c92 Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Sat, 27 Mar 2021 03:20:21 +0000 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/pipewire.git#8efa647705d110709be5e8742e3cd6138889dfbb --- ...start-media-session-through-pipewire.patch | 6 +- ...ewire-pulse-set-correct-errno-values.patch | 80 +++++++++++++++ ...eck-stream-move-after-configuring-a-.patch | 67 +++++++++++++ ...n-t-send-invalid-port-profile-arrays.patch | 51 ++++++++++ ...e-server-fix-route-profile-numbering.patch | 39 ++++++++ ...start-the-node-then-make-it-schedula.patch | 36 +++++++ ...ver-queue-buffers-when-rate-matching.patch | 41 ++++++++ 0008-pulse-server-handle-NULL-proxy.patch | 82 +++++++++++++++ ...dd-the-port-when-buffers-are-negotia.patch | 99 +++++++++++++++++++ ...-server-avoid-returning-NULL-strings.patch | 48 +++++++++ pipewire.spec | 33 +++++-- 11 files changed, 573 insertions(+), 9 deletions(-) create mode 100644 0002-pipewire-pulse-set-correct-errno-values.patch create mode 100644 0003-media-session-check-stream-move-after-configuring-a-.patch create mode 100644 0004-pulse-server-don-t-send-invalid-port-profile-arrays.patch create mode 100644 0005-pulse-server-fix-route-profile-numbering.patch create mode 100644 0006-impl-node-first-start-the-node-then-make-it-schedula.patch create mode 100644 0007-alsa-never-queue-buffers-when-rate-matching.patch create mode 100644 0008-pulse-server-handle-NULL-proxy.patch create mode 100644 0009-impl-port-only-add-the-port-when-buffers-are-negotia.patch create mode 100644 0010-pulse-server-avoid-returning-NULL-strings.patch diff --git a/0001-conf-start-media-session-through-pipewire.patch b/0001-conf-start-media-session-through-pipewire.patch index 57ebb7a..6a42ce5 100644 --- a/0001-conf-start-media-session-through-pipewire.patch +++ b/0001-conf-start-media-session-through-pipewire.patch @@ -1,7 +1,7 @@ -From daf929aa0a50b06218b3269bdde3282549ef70c4 Mon Sep 17 00:00:00 2001 +From cb5a1841e4fdad320e85021ef1c66e5cf52cfc5a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 4 Mar 2021 15:38:16 +0100 -Subject: [PATCH] conf: start media-session through pipewire +Subject: [PATCH 01/10] conf: start media-session through pipewire --- src/daemon/pipewire.conf.in | 2 +- @@ -21,5 +21,5 @@ index 281671c7c..af89fdc05 100644 # You can optionally start the pulseaudio-server here as well # but it is better to start it as a systemd service. -- -2.26.2 +2.26.3 diff --git a/0002-pipewire-pulse-set-correct-errno-values.patch b/0002-pipewire-pulse-set-correct-errno-values.patch new file mode 100644 index 0000000..ad5a110 --- /dev/null +++ b/0002-pipewire-pulse-set-correct-errno-values.patch @@ -0,0 +1,80 @@ +From 503feaa3fa857982c5f1b3c8cfc224ea99cd17a5 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Fri, 19 Mar 2021 12:46:05 +0100 +Subject: [PATCH 02/10] pipewire-pulse: set correct errno values + +errno should be set to the positive errno value. + +This does not cause problems except for the pulse-server where the +errno value is negated and returned as an error result. +--- + spa/plugins/alsa/alsa-pcm-device.c | 2 +- + spa/plugins/bluez5/bluez5-device.c | 4 ++-- + spa/plugins/jack/jack-device.c | 2 +- + src/modules/module-protocol-pulse/module.c | 2 +- + 4 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/spa/plugins/alsa/alsa-pcm-device.c b/spa/plugins/alsa/alsa-pcm-device.c +index 285a76f28..af30ed2da 100644 +--- a/spa/plugins/alsa/alsa-pcm-device.c ++++ b/spa/plugins/alsa/alsa-pcm-device.c +@@ -355,7 +355,7 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * + desc = "On"; + break; + default: +- errno = -EINVAL; ++ errno = EINVAL; + return NULL; + } + +diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c +index 7a747f415..b8d8ae5a9 100644 +--- a/spa/plugins/bluez5/bluez5-device.c ++++ b/spa/plugins/bluez5/bluez5-device.c +@@ -660,7 +660,7 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * + break; + } + default: +- errno = -EINVAL; ++ errno = EINVAL; + return NULL; + } + +@@ -775,7 +775,7 @@ static struct spa_pod *build_route(struct impl *this, struct spa_pod_builder *b, + snprintf(name, sizeof(name), "%s-output", name_prefix); + break; + default: +- errno = -EINVAL; ++ errno = EINVAL; + return NULL; + } + +diff --git a/spa/plugins/jack/jack-device.c b/spa/plugins/jack/jack-device.c +index 75d6522e8..3c56e0a20 100644 +--- a/spa/plugins/jack/jack-device.c ++++ b/spa/plugins/jack/jack-device.c +@@ -244,7 +244,7 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * + desc = "On"; + break; + default: +- errno = -EINVAL; ++ errno = EINVAL; + return NULL; + } + +diff --git a/src/modules/module-protocol-pulse/module.c b/src/modules/module-protocol-pulse/module.c +index 52a90fbe3..987f65ef7 100644 +--- a/src/modules/module-protocol-pulse/module.c ++++ b/src/modules/module-protocol-pulse/module.c +@@ -176,7 +176,7 @@ static struct module *create_module(struct client *client, const char *name, con + + info = find_module_info(name); + if (info == NULL) { +- errno = -ENOENT; ++ errno = ENOENT; + return NULL; + } + module = info->create(impl, args); +-- +2.26.3 + diff --git a/0003-media-session-check-stream-move-after-configuring-a-.patch b/0003-media-session-check-stream-move-after-configuring-a-.patch new file mode 100644 index 0000000..3c9900b --- /dev/null +++ b/0003-media-session-check-stream-move-after-configuring-a-.patch @@ -0,0 +1,67 @@ +From edf102a6659b4eb58eebf055d459e182508a521c Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Fri, 19 Mar 2021 15:51:17 +0100 +Subject: [PATCH 03/10] media-session: check stream move after configuring a + new node + +When a new node is configured, check if existing streams might need to +be moved to it. + +This fixes the case where a stream has a target node set to some +bluetooth device and it starts playing to the default device because +the bluetooth device is not connected. When the BT device is then +connected and configured, the stream is moved to the new BT device. +--- + src/examples/media-session/policy-node.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/src/examples/media-session/policy-node.c b/src/examples/media-session/policy-node.c +index 966da2fe3..7ed73e9a5 100644 +--- a/src/examples/media-session/policy-node.c ++++ b/src/examples/media-session/policy-node.c +@@ -123,6 +123,8 @@ struct node { + unsigned int virtual:1; + }; + ++static int check_new_target(struct impl *impl, struct node *target); ++ + static bool find_format(struct node *node) + { + struct impl *impl = node->impl; +@@ -210,6 +212,9 @@ static int configure_node(struct node *node, struct spa_audio_info *info, bool f + + node->configured = true; + ++ if (node->type == NODE_TYPE_DEVICE) ++ check_new_target(impl, node); ++ + return 0; + } + +@@ -970,6 +975,23 @@ static int handle_move(struct impl *impl, struct node *src_node, struct node *ds + return do_move_node(src_node, src_node->peer, dst_node); + } + ++static int check_new_target(struct impl *impl, struct node *target) ++{ ++ struct node *node; ++ const char *str = get_device_name(target); ++ ++ spa_list_for_each(node, &impl->node_list, link) { ++ pw_log_debug(NAME" %p: node %d target '%s' find:%s", impl, ++ node->id, node->obj->target_node, str); ++ ++ if (node->obj->target_node != NULL && ++ strcmp(node->obj->target_node , str) == 0) { ++ handle_move(impl, node, target); ++ } ++ } ++ return 0; ++} ++ + static int metadata_property(void *object, uint32_t subject, + const char *key, const char *type, const char *value) + { +-- +2.26.3 + diff --git a/0004-pulse-server-don-t-send-invalid-port-profile-arrays.patch b/0004-pulse-server-don-t-send-invalid-port-profile-arrays.patch new file mode 100644 index 0000000..a78ffb2 --- /dev/null +++ b/0004-pulse-server-don-t-send-invalid-port-profile-arrays.patch @@ -0,0 +1,51 @@ +From c0897f2f2cb02d1f1f7893e84c1961313d60c0aa Mon Sep 17 00:00:00 2001 +From: Pauli Virtanen +Date: Sat, 20 Mar 2021 15:02:55 +0200 +Subject: [PATCH 04/10] pulse-server: don't send invalid port profile arrays + +libpulse assumes in introspect.c:fill_card_port_info that port profile +array size <= card profile array size, and may crash otherwise. + +Enforce this in fill_card_info. It can happen, if EnumRoute and +EnumProfile info is not in sync. +--- + src/modules/module-protocol-pulse/pulse-server.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c +index cf15acce1..842abb16e 100644 +--- a/src/modules/module-protocol-pulse/pulse-server.c ++++ b/src/modules/module-protocol-pulse/pulse-server.c +@@ -3933,7 +3933,7 @@ static int fill_card_info(struct client *client, struct message *m, + for (n = 0; n < n_ports; n++) { + struct spa_dict_item *items; + struct spa_dict *pdict = NULL, dict; +- uint32_t i; ++ uint32_t i, pi_n_profiles; + + pi = &port_info[n]; + +@@ -3952,11 +3952,18 @@ static int fill_card_info(struct client *client, struct message *m, + TAG_PROPLIST, pdict, /* port proplist */ + TAG_INVALID); + ++ pi_n_profiles = SPA_MIN(pi->n_profiles, n_profiles); ++ if (pi->n_profiles != pi_n_profiles) { ++ /* libpulse assumes port profile array size <= n_profiles */ ++ pw_log_error(NAME" %p: card %d port %d profiles inconsistent (%d < %d)", ++ client->impl, o->id, n, n_profiles, pi->n_profiles); ++ } ++ + message_put(m, +- TAG_U32, pi->n_profiles, /* n_profiles */ ++ TAG_U32, pi_n_profiles, /* n_profiles */ + TAG_INVALID); + +- for (i = 0; i < pi->n_profiles; i++) { ++ for (i = 0; i < pi_n_profiles; i++) { + uint32_t idx = pi->profiles[i]; + message_put(m, + TAG_STRING, idx < n_profiles ? +-- +2.26.3 + diff --git a/0005-pulse-server-fix-route-profile-numbering.patch b/0005-pulse-server-fix-route-profile-numbering.patch new file mode 100644 index 0000000..30cc206 --- /dev/null +++ b/0005-pulse-server-fix-route-profile-numbering.patch @@ -0,0 +1,39 @@ +From 00782c4d5b3fc0a6ec3ac8e6f14d317c609ecd7c Mon Sep 17 00:00:00 2001 +From: Pauli Virtanen +Date: Sat, 20 Mar 2021 15:32:26 +0200 +Subject: [PATCH 05/10] pulse-server: fix route profile numbering + +Route profile numbers refer to profile ids, not indices. +--- + src/modules/module-protocol-pulse/pulse-server.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c +index 842abb16e..7a6082198 100644 +--- a/src/modules/module-protocol-pulse/pulse-server.c ++++ b/src/modules/module-protocol-pulse/pulse-server.c +@@ -3964,10 +3964,18 @@ static int fill_card_info(struct client *client, struct message *m, + TAG_INVALID); + + for (i = 0; i < pi_n_profiles; i++) { +- uint32_t idx = pi->profiles[i]; ++ uint32_t j; ++ const char *name = "off"; ++ ++ for (j = 0; j < n_profiles; ++j) { ++ if (profile_info[j].id == pi->profiles[i]) { ++ name = profile_info[j].name; ++ break; ++ } ++ } ++ + message_put(m, +- TAG_STRING, idx < n_profiles ? +- profile_info[idx].name : "off", /* profile name */ ++ TAG_STRING, name, /* profile name */ + TAG_INVALID); + } + if (client->version >= 27) { +-- +2.26.3 + diff --git a/0006-impl-node-first-start-the-node-then-make-it-schedula.patch b/0006-impl-node-first-start-the-node-then-make-it-schedula.patch new file mode 100644 index 0000000..82d526a --- /dev/null +++ b/0006-impl-node-first-start-the-node-then-make-it-schedula.patch @@ -0,0 +1,36 @@ +From f5aba5f0dcf63996bd2444da13f353b290da3601 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Tue, 23 Mar 2021 10:17:01 +0100 +Subject: [PATCH 06/10] impl-node: first start the node, then make it + schedulable + +We first need to issue the start command for driver nodes and then +we can add the node to be scheduled. Else we might end up with nodes +that receive the _process callback without the Start command being +called first and we can crash. + +See #904 +--- + src/pipewire/impl-node.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c +index 0afcab53e..75a7d2a79 100644 +--- a/src/pipewire/impl-node.c ++++ b/src/pipewire/impl-node.c +@@ -338,10 +338,11 @@ static void node_update_state(struct pw_impl_node *node, enum pw_node_state stat + + switch (state) { + case PW_NODE_STATE_RUNNING: +- pw_loop_invoke(node->data_loop, do_node_add, 1, NULL, 0, true, node); + if (node->driving && node->driver) + spa_node_send_command(node->node, + &SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Start)); ++ ++ pw_loop_invoke(node->data_loop, do_node_add, 1, NULL, 0, true, node); + break; + default: + break; +-- +2.26.3 + diff --git a/0007-alsa-never-queue-buffers-when-rate-matching.patch b/0007-alsa-never-queue-buffers-when-rate-matching.patch new file mode 100644 index 0000000..dd3504c --- /dev/null +++ b/0007-alsa-never-queue-buffers-when-rate-matching.patch @@ -0,0 +1,41 @@ +From aaffc0947a8144b6cfaa5ccc076bc8a7b64fb755 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Wed, 24 Mar 2021 11:48:32 +0100 +Subject: [PATCH 07/10] alsa: never queue buffers when rate matching + +When we are following the resampler requested size in capture, never +keep queued buffers around or we might get out of sync with the +requested size and cause cracks and pops in the resampler. + +See #805 +--- + spa/plugins/alsa/alsa-pcm.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c +index 911f12ba2..00d554070 100644 +--- a/spa/plugins/alsa/alsa-pcm.c ++++ b/spa/plugins/alsa/alsa-pcm.c +@@ -1147,6 +1147,9 @@ push_frames(struct state *state, + snd_pcm_readi(state->hndl, bufs[0], total_frames); + } + } ++ spa_log_trace_fp(state->log, NAME" %p: wrote %ld frames into buffer %d", ++ state, total_frames, b->id); ++ + spa_list_append(&state->ready, &b->link); + } + return total_frames; +@@ -1307,7 +1310,8 @@ static int handle_capture(struct state *state, uint64_t nsec, + return 0; + + io = state->io; +- if (io != NULL && io->status != SPA_STATUS_HAVE_DATA) { ++ if (io != NULL && ++ (io->status != SPA_STATUS_HAVE_DATA || state->rate_match != NULL)) { + struct buffer *b; + + if (io->buffer_id < state->n_buffers) +-- +2.26.3 + diff --git a/0008-pulse-server-handle-NULL-proxy.patch b/0008-pulse-server-handle-NULL-proxy.patch new file mode 100644 index 0000000..6437227 --- /dev/null +++ b/0008-pulse-server-handle-NULL-proxy.patch @@ -0,0 +1,82 @@ +From e5a58f1abb75fd1d51f4e769f0fffdc287ecd2d1 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Thu, 25 Mar 2021 09:08:13 +0100 +Subject: [PATCH 08/10] pulse-server: handle NULL proxy + +The proxy could be removed before we get the global remove so we need +to handle the case where we access an object without a proxy and +avoid a crash. +--- + src/modules/module-protocol-pulse/manager.c | 2 ++ + src/modules/module-protocol-pulse/pulse-server.c | 14 ++++++++++++++ + 2 files changed, 16 insertions(+) + +diff --git a/src/modules/module-protocol-pulse/manager.c b/src/modules/module-protocol-pulse/manager.c +index 184b08035..78b8d1bb8 100644 +--- a/src/modules/module-protocol-pulse/manager.c ++++ b/src/modules/module-protocol-pulse/manager.c +@@ -711,6 +711,8 @@ int pw_manager_set_metadata(struct pw_manager *manager, + return -ENOTSUP; + if (!SPA_FLAG_IS_SET(metadata->permissions, PW_PERM_W|PW_PERM_X)) + return -EACCES; ++ if (metadata->proxy == NULL) ++ return -ENOENT; + + if (type != NULL) { + va_start(args, format); +diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c +index 7a6082198..8efd2d609 100644 +--- a/src/modules/module-protocol-pulse/pulse-server.c ++++ b/src/modules/module-protocol-pulse/pulse-server.c +@@ -3034,6 +3034,8 @@ static int set_node_volume_mute(struct pw_manager_object *o, + + if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X)) + return -EACCES; ++ if (o->proxy == NULL) ++ return -ENOENT; + + spa_pod_builder_push_object(&b, &f[0], + SPA_TYPE_OBJECT_Props, SPA_PARAM_Props); +@@ -3064,6 +3066,9 @@ static int set_card_volume_mute_delay(struct pw_manager_object *o, uint32_t id, + if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X)) + return -EACCES; + ++ if (o->proxy == NULL) ++ return -ENOENT; ++ + spa_pod_builder_push_object(&b, &f[0], + SPA_TYPE_OBJECT_ParamRoute, SPA_PARAM_Route); + spa_pod_builder_add(&b, +@@ -3104,6 +3109,9 @@ static int set_card_port(struct pw_manager_object *o, uint32_t device_id, + if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X)) + return -EACCES; + ++ if (o->proxy == NULL) ++ return -ENOENT; ++ + pw_device_set_param((struct pw_device*)o->proxy, + SPA_PARAM_Route, 0, + spa_pod_builder_add_object(&b, +@@ -4888,6 +4896,9 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag, + if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X)) + return -EACCES; + ++ if (o->proxy == NULL) ++ return -ENOENT; ++ + pw_device_set_param((struct pw_device*)o->proxy, + SPA_PARAM_Profile, 0, + spa_pod_builder_add_object(&b, +@@ -4960,6 +4971,9 @@ static int do_suspend(struct client *client, uint32_t command, uint32_t tag, str + if ((o = find_device(client, id, name, sink)) == NULL) + return -ENOENT; + ++ if (o->proxy == NULL) ++ return -ENOENT; ++ + if (suspend) { + cmd = SPA_NODE_COMMAND_Suspend; + pw_node_send_command((struct pw_node*)o->proxy, &SPA_NODE_COMMAND_INIT(cmd)); +-- +2.26.3 + diff --git a/0009-impl-port-only-add-the-port-when-buffers-are-negotia.patch b/0009-impl-port-only-add-the-port-when-buffers-are-negotia.patch new file mode 100644 index 0000000..1cb29c4 --- /dev/null +++ b/0009-impl-port-only-add-the-port-when-buffers-are-negotia.patch @@ -0,0 +1,99 @@ +From f918e5e2c782b0dbc9d189ebe330a121c829193f Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Thu, 25 Mar 2021 11:30:58 +0100 +Subject: [PATCH 09/10] impl-port: only add the port when buffers are + negotiated + +To avoid crashes when the node is scheduled but buffer have been +cleared. + +See #904 +--- + src/pipewire/impl-port.c | 24 +++++++++++++++++++----- + src/pipewire/private.h | 5 +++-- + 2 files changed, 22 insertions(+), 7 deletions(-) + +diff --git a/src/pipewire/impl-port.c b/src/pipewire/impl-port.c +index bd6074d7f..9b1a0455b 100644 +--- a/src/pipewire/impl-port.c ++++ b/src/pipewire/impl-port.c +@@ -961,8 +961,6 @@ int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node) + if (node->global) + pw_impl_port_register(port, NULL); + +- pw_loop_invoke(node->data_loop, do_add_port, SPA_ID_INVALID, NULL, 0, false, port); +- + if (port->state <= PW_IMPL_PORT_STATE_INIT) + pw_impl_port_update_state(port, PW_IMPL_PORT_STATE_CONFIGURE, 0, NULL); + +@@ -1001,10 +999,13 @@ static void pw_impl_port_remove(struct pw_impl_port *port) + if (node == NULL) + return; + +- pw_log_debug(NAME" %p: remove", port); ++ pw_log_debug(NAME" %p: remove added:%d", port, port->added); + +- pw_loop_invoke(port->node->data_loop, do_remove_port, +- SPA_ID_INVALID, NULL, 0, true, port); ++ if (port->added) { ++ pw_loop_invoke(node->data_loop, do_remove_port, ++ SPA_ID_INVALID, NULL, 0, true, port); ++ port->added = false; ++ } + + if (SPA_FLAG_IS_SET(port->flags, PW_IMPL_PORT_FLAG_TO_REMOVE)) { + if ((res = spa_node_remove_port(node->node, port->direction, port->port_id)) < 0) +@@ -1295,6 +1296,10 @@ int pw_impl_port_set_param(struct pw_impl_port *port, uint32_t id, uint32_t flag + if (id == SPA_PARAM_Format) { + pw_log_debug(NAME" %p: %d %p %d", port, port->state, param, res); + ++ if (port->added) { ++ pw_loop_invoke(node->data_loop, do_remove_port, SPA_ID_INVALID, NULL, 0, true, port); ++ port->added = false; ++ } + /* setting the format always destroys the negotiated buffers */ + pw_buffers_clear(&port->buffers); + pw_buffers_clear(&port->mix_buffers); +@@ -1327,6 +1332,11 @@ static int negotiate_mixer_buffers(struct pw_impl_port *port, uint32_t flags, + pw_log_debug(NAME" %p: %d.%d negotiate %d buffers on node: %p", + port, port->direction, port->port_id, n_buffers, node->node); + ++ if (port->added) { ++ pw_loop_invoke(node->data_loop, do_remove_port, SPA_ID_INVALID, NULL, 0, true, port); ++ port->added = false; ++ } ++ + pw_buffers_clear(&port->mix_buffers); + + if (n_buffers > 0) { +@@ -1356,6 +1366,10 @@ static int negotiate_mixer_buffers(struct pw_impl_port *port, uint32_t flags, + pw_direction_reverse(port->direction), 0, + 0, buffers, n_buffers); + } ++ if (!port->added && n_buffers > 0) { ++ pw_loop_invoke(node->data_loop, do_add_port, SPA_ID_INVALID, NULL, 0, false, port); ++ port->added = true; ++ } + return res; + } + +diff --git a/src/pipewire/private.h b/src/pipewire/private.h +index 186de6fd1..e6b6788aa 100644 +--- a/src/pipewire/private.h ++++ b/src/pipewire/private.h +@@ -786,9 +786,10 @@ struct pw_impl_port { + struct spa_list mix_list; + struct spa_list node_link; + } rt; /**< data only accessed from the data thread */ ++ unsigned int added:1; + +- void *owner_data; /**< extra owner data */ +- void *user_data; /**< extra user data */ ++ void *owner_data; /**< extra owner data */ ++ void *user_data; /**< extra user data */ + }; + + struct pw_control_link { +-- +2.26.3 + diff --git a/0010-pulse-server-avoid-returning-NULL-strings.patch b/0010-pulse-server-avoid-returning-NULL-strings.patch new file mode 100644 index 0000000..4665795 --- /dev/null +++ b/0010-pulse-server-avoid-returning-NULL-strings.patch @@ -0,0 +1,48 @@ +From d53adf0ba12761fa690ce1b8e1d4f85dc961338d Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Thu, 25 Mar 2021 15:33:18 +0100 +Subject: [PATCH 10/10] pulse-server: avoid returning NULL strings + +Don't return a NULL string when converting an id to a string because +some callers don't expect this and crash. +--- + src/modules/module-protocol-pulse/format.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/modules/module-protocol-pulse/format.c b/src/modules/module-protocol-pulse/format.c +index 33d8ffb48..f4424cd3f 100644 +--- a/src/modules/module-protocol-pulse/format.c ++++ b/src/modules/module-protocol-pulse/format.c +@@ -129,7 +129,8 @@ static inline const char *format_id2paname(uint32_t id) + { + size_t i; + for (i = 0; i < SPA_N_ELEMENTS(audio_formats); i++) { +- if (id == audio_formats[i].id) ++ if (id == audio_formats[i].id && ++ audio_formats[i].name != NULL) + return audio_formats[i].name; + } + return "invalid"; +@@ -371,7 +372,8 @@ static inline const char *channel_id2paname(uint32_t id, uint32_t *aux) + { + size_t i; + for (i = 0; i < SPA_N_ELEMENTS(audio_channels); i++) { +- if (id == audio_channels[i].channel) ++ if (id == audio_channels[i].channel && ++ audio_channels[i].name != NULL) + return audio_channels[i].name; + } + return audio_channels[CHANNEL_POSITION_AUX0 + (*aux)++].name; +@@ -512,7 +514,8 @@ static const char *encoding_names[] = { + + static inline const char *format_encoding2name(enum encoding enc) + { +- if (enc >= 0 && enc < (int)SPA_N_ELEMENTS(encoding_names)) ++ if (enc >= 0 && enc < (int)SPA_N_ELEMENTS(encoding_names) && ++ encoding_names[enc] != NULL) + return encoding_names[enc]; + return "INVALID"; + } +-- +2.26.3 + diff --git a/pipewire.spec b/pipewire.spec index 4838cf6..047685a 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 1 +%global baserelease 4 #global snapdate 20210107 #global gitcommit b17db2cebc1a5ab2c01851d29c05f79cd2f262bb @@ -57,6 +57,16 @@ Source0: https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/%{version}/p ## fedora patches Patch0: 0001-conf-start-media-session-through-pipewire.patch +Patch1: 0002-pipewire-pulse-set-correct-errno-values.patch +Patch2: 0003-media-session-check-stream-move-after-configuring-a-.patch +Patch3: 0004-pulse-server-don-t-send-invalid-port-profile-arrays.patch +Patch4: 0005-pulse-server-fix-route-profile-numbering.patch +Patch5: 0006-impl-node-first-start-the-node-then-make-it-schedula.patch +Patch6: 0007-alsa-never-queue-buffers-when-rate-matching.patch +Patch7: 0008-pulse-server-handle-NULL-proxy.patch +Patch8: 0009-impl-port-only-add-the-port-when-buffers-are-negotia.patch +Patch9: 0010-pulse-server-avoid-returning-NULL-strings.patch + BuildRequires: gettext BuildRequires: meson >= 0.49.0 @@ -264,6 +274,7 @@ This package provides a PulseAudio implementation based on PipeWire mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d/ echo %{_libdir}/pipewire-%{apiversion}/jack/ > %{buildroot}%{_sysconfdir}/ld.so.conf.d/pipewire-jack-%{_arch}.conf %else +rm %{buildroot}%{_sysconfdir}/pipewire/jack.conf rm %{buildroot}%{_sysconfdir}/pipewire/media-session.d/with-jack %endif @@ -280,7 +291,8 @@ touch %{buildroot}%{_sysconfdir}/pipewire/media-session.d/with-alsa # If the PulseAudio replacement isn't being offered, delete the files rm %{buildroot}%{_bindir}/pipewire-pulse rm %{buildroot}%{_userunitdir}/pipewire-pulse.* -rm -rf %{buildroot}%{_sysconfdir}/pipewire/media-session.d/with-pulseaudio +rm %{buildroot}%{_sysconfdir}/pipewire/media-session.d/with-pulseaudio +rm %{buildroot}%{_sysconfdir}/pipewire/pipewire-pulse.conf %endif # We don't start the media session with systemd yet @@ -335,11 +347,7 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || : %{_mandir}/man1/pipewire.1* %dir %{_sysconfdir}/pipewire/ %dir %{_sysconfdir}/pipewire/media-session.d/ -%config(noreplace) %{_sysconfdir}/pipewire/client.conf -%config(noreplace) %{_sysconfdir}/pipewire/client-rt.conf -%config(noreplace) %{_sysconfdir}/pipewire/jack.conf %config(noreplace) %{_sysconfdir}/pipewire/pipewire.conf -%config(noreplace) %{_sysconfdir}/pipewire/pipewire-pulse.conf %config(noreplace) %{_sysconfdir}/pipewire/media-session.d/alsa-monitor.conf %config(noreplace) %{_sysconfdir}/pipewire/media-session.d/bluez-monitor.conf %config(noreplace) %{_sysconfdir}/pipewire/media-session.d/media-session.conf @@ -368,6 +376,8 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || : %if %{with vulkan} %{_libdir}/spa-%{spaversion}/vulkan/ %endif +%config(noreplace) %{_sysconfdir}/pipewire/client.conf +%config(noreplace) %{_sysconfdir}/pipewire/client-rt.conf %files gstreamer %{_libdir}/gstreamer-1.0/libgstpipewire.* @@ -429,6 +439,7 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || : %{_libdir}/pipewire-%{apiversion}/jack/libjack.so* %{_libdir}/pipewire-%{apiversion}/jack/libjacknet.so* %{_libdir}/pipewire-%{apiversion}/jack/libjackserver.so* +%config(noreplace) %{_sysconfdir}/pipewire/jack.conf %config(noreplace) %{_sysconfdir}/pipewire/media-session.d/with-jack %{_sysconfdir}/ld.so.conf.d/pipewire-jack-%{_arch}.conf @@ -441,9 +452,19 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || : %{_bindir}/pipewire-pulse %{_userunitdir}/pipewire-pulse.* %config(noreplace) %{_sysconfdir}/pipewire/media-session.d/with-pulseaudio +%config(noreplace) %{_sysconfdir}/pipewire/pipewire-pulse.conf %endif %changelog +* Thu Mar 25 2021 Wim Taymans - 0.3.24-4 +- Apply some critical upstream patches + +* Thu Mar 25 2021 Kalev Lember - 0.3.24-3 +- Fix RHEL build + +* Thu Mar 25 2021 Kalev Lember - 0.3.24-2 +- Move individual config files to the subpackages that make use of them + * Thu Mar 18 2021 Wim Taymans - 0.3.24-1 - Update to 0.3.24