From fc1903cc66865848dd26e034f606058c68406940 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 10 May 2021 13:20:27 +0200 Subject: [PATCH] Add patch to fix volume issues. --- ...start-media-session-through-pipewire.patch | 6 +- 0002-acp-reset-soft_volume.patch | 63 +++++++++++++++++++ pipewire.spec | 6 +- 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 0002-acp-reset-soft_volume.patch diff --git a/0001-conf-start-media-session-through-pipewire.patch b/0001-conf-start-media-session-through-pipewire.patch index 31f93f1..db5c9dd 100644 --- a/0001-conf-start-media-session-through-pipewire.patch +++ b/0001-conf-start-media-session-through-pipewire.patch @@ -1,7 +1,7 @@ -From 5d64bc8d5691323be7edf45b81c18be6322d0997 Mon Sep 17 00:00:00 2001 +From 9aedfa40e8f5ae5fe7d09635f29d8918b5a3ae4c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 4 Mar 2021 15:38:16 +0100 -Subject: [PATCH 01/10] conf: start media-session through pipewire +Subject: [PATCH 1/2] conf: start media-session through pipewire --- src/daemon/pipewire.conf.in | 2 +- @@ -21,5 +21,5 @@ index 394b2e10..3837ac51 100644 # You can optionally start the pulseaudio-server here as well # but it is better to start it as a systemd service. -- -2.30.2 +2.31.1 diff --git a/0002-acp-reset-soft_volume.patch b/0002-acp-reset-soft_volume.patch new file mode 100644 index 0000000..e5a75e8 --- /dev/null +++ b/0002-acp-reset-soft_volume.patch @@ -0,0 +1,63 @@ +From efa27558b9dcda3a8d77121beae8b264f8204967 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Mon, 10 May 2021 10:50:42 +0200 +Subject: [PATCH 2/2] acp: reset soft_volume + +Reset the software volume when initializing the device and when the +hardware volume is updated. + +The software volume was set to 0 by default and if the session manager +did not change the volume enough to cause a software volume change, +it would remain 0 and there would be silence. + +Also improve the debug a little. + +See #1160 #1167 #1164 #1049 #1117 +--- + spa/plugins/alsa/acp/acp.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c +index 0dab74d3..1b15bd44 100644 +--- a/spa/plugins/alsa/acp/acp.c ++++ b/spa/plugins/alsa/acp/acp.c +@@ -215,6 +215,7 @@ static void init_device(pa_card *impl, pa_alsa_device *dev, pa_alsa_direction_t + dev->device.format.rate_mask = m->sample_spec.rate; + dev->device.format.channels = m->channel_map.channels; + pa_cvolume_reset(&dev->real_volume, m->channel_map.channels); ++ pa_cvolume_reset(&dev->soft_volume, m->channel_map.channels); + for (i = 0; i < m->channel_map.channels; i++) + dev->device.format.map[i]= channel_pa2acp(m->channel_map.map[i]); + dev->direction = direction; +@@ -1033,10 +1034,15 @@ static int read_volume(pa_alsa_device *dev) + return 0; + + dev->real_volume = r; +- pa_log_info("New hardware volume:"); ++ ++ pa_log_info("New hardware volume: min:%d max:%d", ++ pa_cvolume_min(&r), pa_cvolume_max(&r)); ++ + for (i = 0; i < r.channels; i++) + pa_log_debug(" %d: %d", i, r.values[i]); + ++ pa_cvolume_reset(&dev->soft_volume, r.channels); ++ + if (impl->events && impl->events->volume_changed) + impl->events->volume_changed(impl->user_data, &dev->device); + +@@ -1803,7 +1809,10 @@ int acp_device_set_volume(struct acp_device *dev, const float *volume, uint32_t + for (i = 0; i < v.channels; i++) + v.values[i] = pa_sw_volume_from_linear(volume[i % n_volume]);; + +- pa_log_info("Set %s volume: %d", d->set_volume ? "hardware" : "software", pa_cvolume_max(&v)); ++ pa_log_info("Set %s volume: min:%d max:%d", ++ d->set_volume ? "hardware" : "software", ++ pa_cvolume_min(&v), pa_cvolume_max(&v)); ++ + for (i = 0; i < v.channels; i++) + pa_log_debug(" %d: %d", i, v.values[i]); + +-- +2.31.1 + diff --git a/pipewire.spec b/pipewire.spec index 73d105f..a58972c 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 2 #global snapdate 20210107 #global gitcommit b17db2cebc1a5ab2c01851d29c05f79cd2f262bb @@ -53,6 +53,7 @@ Source0: https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/%{ver %endif ## upstream patches +Patch0001: 0002-acp-reset-soft_volume.patch ## upstreamable patches @@ -473,6 +474,9 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || : %endif %changelog +* Mon May 10 2021 Wim Taymans - 0.3.27-2 +- Add patch to fix volume issues. + * Thu May 06 2021 Wim Taymans - 0.3.27-1 - Update to 0.3.27