diff --git a/0001-pulse-server-don-t-underrun-when-draining.patch b/0001-pulse-server-don-t-underrun-when-draining.patch new file mode 100644 index 0000000..0c1c8f5 --- /dev/null +++ b/0001-pulse-server-don-t-underrun-when-draining.patch @@ -0,0 +1,37 @@ +From 98b1b8090dbffe1dfa6e1883b2550008833a568a Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Sat, 31 Oct 2020 15:22:32 +0100 +Subject: [PATCH 1/3] pulse-server: don't underrun when draining + +--- + src/modules/module-protocol-pulse/pulse-server.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c +index a4162280..dbc52431 100644 +--- a/src/modules/module-protocol-pulse/pulse-server.c ++++ b/src/modules/module-protocol-pulse/pulse-server.c +@@ -1276,13 +1276,15 @@ static void stream_process(void *data) + int32_t avail = spa_ringbuffer_get_read_index(&stream->ring, &pd.read_index); + if (avail <= 0) { + /* underrun */ +- if (stream->drain_tag) +- pw_stream_flush(stream->stream, true); +- + size = buf->datas[0].maxsize; + memset(p, 0, size); +- pd.underrun_for = size; +- pd.underrun = true; ++ ++ if (stream->drain_tag) ++ pw_stream_flush(stream->stream, true); ++ else { ++ pd.underrun_for = size; ++ pd.underrun = true; ++ } + } else if (avail > MAXLENGTH) { + /* overrun, handled by other side */ + pw_log_warn(NAME" %p: overrun", stream); +-- +2.28.0 + diff --git a/0002-pulse-server-use-name-if-description-not-set.patch b/0002-pulse-server-use-name-if-description-not-set.patch new file mode 100644 index 0000000..014a33a --- /dev/null +++ b/0002-pulse-server-use-name-if-description-not-set.patch @@ -0,0 +1,34 @@ +From 4bb859fb82d4d8128e146937289d560a8efa0fc3 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Sat, 31 Oct 2020 21:20:39 +0100 +Subject: [PATCH 2/3] pulse-server: use name if description not set + +--- + src/modules/module-protocol-pulse/collect.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/modules/module-protocol-pulse/collect.c b/src/modules/module-protocol-pulse/collect.c +index 130af355..9be5a8ae 100644 +--- a/src/modules/module-protocol-pulse/collect.c ++++ b/src/modules/module-protocol-pulse/collect.c +@@ -244,6 +244,8 @@ static uint32_t collect_profile_info(struct pw_manager_object *card, struct card + SPA_PARAM_PROFILE_classes, SPA_POD_OPT_Pod(&classes)) < 0) { + continue; + } ++ if (pi->description == NULL) ++ pi->description = pi->name; + if (pi->id == card_info->active_profile) + card_info->active_profile_name = pi->name; + +@@ -443,6 +445,8 @@ static uint32_t collect_port_info(struct pw_manager_object *card, struct card_in + SPA_PARAM_ROUTE_profiles, SPA_POD_OPT_Pod(&profiles)) < 0) + continue; + ++ if (pi->description == NULL) ++ pi->description = pi->name; + if (devices) + pi->devices = spa_pod_get_array(devices, &pi->n_devices); + if (profiles) +-- +2.28.0 + diff --git a/0003-pulse-server-don-t-ever-block.patch b/0003-pulse-server-don-t-ever-block.patch new file mode 100644 index 0000000..64791b4 --- /dev/null +++ b/0003-pulse-server-don-t-ever-block.patch @@ -0,0 +1,39 @@ +From 165ad6e75816f6d8b3273261a4f6d6dd8b7457f6 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Sat, 31 Oct 2020 21:21:00 +0100 +Subject: [PATCH 3/3] pulse-server: don't ever block + +Handle EAGAIN and EWOULDBLOCK and go back into the poll loop instead +of blocking. +--- + src/modules/module-protocol-pulse/pulse-server.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c +index dbc52431..e1733b29 100644 +--- a/src/modules/module-protocol-pulse/pulse-server.c ++++ b/src/modules/module-protocol-pulse/pulse-server.c +@@ -267,6 +267,8 @@ static int flush_messages(struct client *client) + res = send(client->source->fd, data, size, MSG_NOSIGNAL | MSG_DONTWAIT); + if (res < 0) { + pw_log_info("send channel:%d %zu, res %d: %m", m->channel, size, res); ++ if (errno == EAGAIN || errno == EWOULDBLOCK) ++ break; + if (errno == EINTR) + continue; + else +@@ -3974,7 +3976,10 @@ static int do_read(struct client *client) + size = client->message->length - idx; + } + while (true) { +- if ((r = recv(client->source->fd, data, size, 0)) < 0) { ++ if ((r = recv(client->source->fd, data, size, MSG_DONTWAIT)) < 0) { ++ pw_log_info("recv client:%p res %d: %m", client, res); ++ if (errno == EAGAIN || errno == EWOULDBLOCK) ++ goto exit; + if (errno == EINTR) + continue; + res = -errno; +-- +2.28.0 + diff --git a/pipewire.spec b/pipewire.spec index 7a290c1..cd0055f 100644 --- a/pipewire.spec +++ b/pipewire.spec @@ -29,7 +29,7 @@ Name: pipewire Summary: Media Sharing Server Version: %{majorversion}.%{minorversion}.%{microversion} -Release: 1%{?snap:.%{snap}git%{shortcommit}}%{?dist} +Release: 2%{?snap:.%{snap}git%{shortcommit}}%{?dist} License: MIT URL: https://pipewire.org/ %if 0%{?gitrel} @@ -41,6 +41,10 @@ Source0: https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/%{version}/p %endif ## upstream patches +Patch1: 0001-pulse-server-don-t-underrun-when-draining.patch +Patch2: 0002-pulse-server-use-name-if-description-not-set.patch +Patch3: 0003-pulse-server-don-t-ever-block.patch + ## upstreamable patches @@ -219,6 +223,9 @@ This package provides a PulseAudio implementation based on PipeWire %setup -q -T -b0 -n %{name}-%{version}%{?gitrel:-%{gitrel}-g%{shortcommit}} %patch0 -p1 -b .0000 +%patch1 -p1 -b .0001 +%patch2 -p1 -b .0002 +%patch3 -p1 -b .0003 %build %meson \ @@ -415,6 +422,9 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || : %endif %changelog +* Sun Nov 1 2020 Wim Taymans - 0.3.14-2 +- Add some pulse server patches + * Fri Oct 30 2020 Wim Taymans - 0.3.14-1 - Update to 0.3.14