Add some more UCM patches

Fix missing UCM mixers crash (#1815437)
This commit is contained in:
Wim Taymans 2020-03-20 12:24:42 +01:00
parent c9878fea1e
commit de7aed422e
6 changed files with 238 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From 9641a4f5e8601350f67e89480e41aaf3a64b8799 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 11 Feb 2020 10:54:16 +0100
Subject: [PATCH 1/5] alsa-ucm: correct the channel default logic (stereo)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/modules/alsa/alsa-ucm.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index a57be6d22..b7d2c5b9c 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -377,6 +377,13 @@ static int ucm_get_device_property(
pa_log("UCM playback device %s fetch pcm failed", device_name);
}
+ if (pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_SINK) &&
+ device->playback_channels == 0) {
+ pa_log("UCM file does not specify 'PlaybackChannels' "
+ "for device %s, assuming stereo duplex.", device_name);
+ device->playback_channels = 2;
+ }
+
value = pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_CAPTURE_CHANNELS);
if (value) { /* input */
/* get channels */
@@ -391,10 +398,10 @@ static int ucm_get_device_property(
pa_log("UCM capture device %s fetch pcm failed", device_name);
}
- if (device->playback_channels == 0 && device->capture_channels == 0) {
- pa_log_warn("UCM file does not specify 'PlaybackChannels' or 'CaptureChannels'"
+ if (pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_SOURCE) &&
+ device->capture_channels == 0) {
+ pa_log("UCM file does not specify 'CaptureChannels' "
"for device %s, assuming stereo duplex.", device_name);
- device->playback_channels = 2;
device->capture_channels = 2;
}
--
2.24.1

View File

@ -0,0 +1,31 @@
From 7790513cb20737d6ff6991b79d6dfbc227d94909 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Sun, 1 Mar 2020 15:55:07 +0100
Subject: [PATCH 2/5] alsa ucm: do not assign JackHWMute when JackControl is
missing for the UCM device
Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/14
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/modules/alsa/alsa-ucm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index b7d2c5b9c..8df24e7b5 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -1730,6 +1730,10 @@ static int ucm_create_profile(
/* JackHWMute contains a list of device names. Each listed device must
* be associated with the jack object that we just created. */
jack_hw_mute = pa_proplist_gets(dev->proplist, PA_ALSA_PROP_UCM_JACK_HW_MUTE);
+ if (jack_hw_mute && !jack) {
+ pa_log("[%s] JackHWMute set, but JackControl is missing", name);
+ jack_hw_mute = NULL;
+ }
if (jack_hw_mute) {
char *hw_mute_device_name;
const char *state = NULL;
--
2.24.1

View File

@ -0,0 +1,45 @@
From 80e4f6363e1a9e1937fb6527b64896ec3da43df7 Mon Sep 17 00:00:00 2001
From: Tanu Kaskinen <tanuk@iki.fi>
Date: Tue, 17 Mar 2020 09:26:57 +0200
Subject: [PATCH 3/5] ucm: Don't log errors during normal operation
It's completely normal to not have explicit channel configuration for
stereo devices. In fact, the ALSA developers actively avoid configuring
the channels for stereo devices.
I also dropped the word "duplex" from the messages, because "stereo
duplex" implies bidirectionality, but most devices use one direction
only.
---
src/modules/alsa/alsa-ucm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index 8df24e7b5..37cbafae5 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -379,8 +379,8 @@ static int ucm_get_device_property(
if (pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_SINK) &&
device->playback_channels == 0) {
- pa_log("UCM file does not specify 'PlaybackChannels' "
- "for device %s, assuming stereo duplex.", device_name);
+ pa_log_info("UCM file does not specify 'PlaybackChannels' "
+ "for device %s, assuming stereo.", device_name);
device->playback_channels = 2;
}
@@ -400,8 +400,8 @@ static int ucm_get_device_property(
if (pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_SOURCE) &&
device->capture_channels == 0) {
- pa_log("UCM file does not specify 'CaptureChannels' "
- "for device %s, assuming stereo duplex.", device_name);
+ pa_log_info("UCM file does not specify 'CaptureChannels' "
+ "for device %s, assuming stereo.", device_name);
device->capture_channels = 2;
}
--
2.24.1

View File

@ -0,0 +1,61 @@
From 636dca6a61c0ddbd4cfcdde75ac0c97ffa96aebf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali.rohar@gmail.com>
Date: Thu, 19 Mar 2020 14:02:40 +0100
Subject: [PATCH 4/5] bluetooth: Ensure that only one A2DP codec is registered
to bluez
Support for multiple codecs needs to use a new Bluez API which pulseaudio
does not implement yet.
So register explicitly only SBC codec which is provided by pulseaudio A2DP
codec API.
---
src/modules/bluetooth/bluez5-util.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index d95c9c117..a21896ede 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -944,8 +944,9 @@ static void parse_interfaces_and_properties(pa_bluetooth_discovery *y, DBusMessa
pa_assert(dbus_message_iter_get_arg_type(&iface_i) == DBUS_TYPE_ARRAY);
if (pa_streq(interface, BLUEZ_ADAPTER_INTERFACE)) {
+
+ const pa_a2dp_codec *a2dp_codec_sbc;
pa_bluetooth_adapter *a;
- unsigned a2dp_codec_i;
if ((a = pa_hashmap_get(y->adapters, path))) {
pa_log_error("Found duplicated D-Bus path for adapter %s", path);
@@ -960,20 +961,13 @@ static void parse_interfaces_and_properties(pa_bluetooth_discovery *y, DBusMessa
if (!a->valid)
return;
- /* Order is important. bluez prefers endpoints registered earlier.
- * And codec with higher number has higher priority. So iterate in reverse order. */
- for (a2dp_codec_i = pa_bluetooth_a2dp_codec_count(); a2dp_codec_i > 0; a2dp_codec_i--) {
- const pa_a2dp_codec *a2dp_codec = pa_bluetooth_a2dp_codec_iter(a2dp_codec_i-1);
- char *endpoint;
-
- endpoint = pa_sprintf_malloc("%s/%s", A2DP_SINK_ENDPOINT, a2dp_codec->name);
- register_endpoint(y, a2dp_codec, path, endpoint, PA_BLUETOOTH_UUID_A2DP_SINK);
- pa_xfree(endpoint);
-
- endpoint = pa_sprintf_malloc("%s/%s", A2DP_SOURCE_ENDPOINT, a2dp_codec->name);
- register_endpoint(y, a2dp_codec, path, endpoint, PA_BLUETOOTH_UUID_A2DP_SOURCE);
- pa_xfree(endpoint);
- }
+ /* Currently only one A2DP codec is supported, so register only SBC
+ * Support for multiple codecs needs to use a new Bluez API which
+ * pulseaudio does not implement yet, patches are waiting in queue */
+ a2dp_codec_sbc = pa_bluetooth_get_a2dp_codec("sbc");
+ pa_assert(a2dp_codec_sbc);
+ register_endpoint(y, a2dp_codec_sbc, path, A2DP_SINK_ENDPOINT "/sbc", PA_BLUETOOTH_UUID_A2DP_SINK);
+ register_endpoint(y, a2dp_codec_sbc, path, A2DP_SOURCE_ENDPOINT "/sbc", PA_BLUETOOTH_UUID_A2DP_SOURCE);
} else if (pa_streq(interface, BLUEZ_DEVICE_INTERFACE)) {
--
2.24.1

View File

@ -0,0 +1,41 @@
From e414863ec1502664efbc83586028793e08277b76 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Fri, 20 Mar 2020 12:03:08 +0100
Subject: [PATCH 5/5] alsa: handle unavailbale HW volume in UCM
It is possible that UCM doesn't specify hardware volume controls.
Fall back to software controls instead of aborting.
---
src/modules/alsa/alsa-sink.c | 2 +-
src/modules/alsa/alsa-source.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 042d4dfd9..65430caed 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1654,7 +1654,7 @@ static int sink_set_port_ucm_cb(pa_sink *s, pa_device_port *p) {
pa_assert(u->ucm_context);
data = PA_DEVICE_PORT_DATA(p);
- pa_assert_se(u->mixer_path = data->path);
+ u->mixer_path = data->path;
mixer_volume_init(u);
if (s->flags & PA_SINK_DEFERRED_VOLUME)
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 104de4e26..c33f81e35 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1525,7 +1525,7 @@ static int source_set_port_ucm_cb(pa_source *s, pa_device_port *p) {
pa_assert(u->ucm_context);
data = PA_DEVICE_PORT_DATA(p);
- pa_assert_se(u->mixer_path = data->path);
+ u->mixer_path = data->path;
mixer_volume_init(u);
if (s->flags & PA_SOURCE_DEFERRED_VOLUME)
--
2.24.1

View File

@ -31,7 +31,7 @@
Name: pulseaudio
Summary: Improved Linux Sound Server
Version: %{pa_major}%{?pa_minor:.%{pa_minor}}
Release: 1%{?snap:.%{snap}git%{shortcommit}}%{?dist}
Release: 2%{?snap:.%{snap}git%{shortcommit}}%{?dist}
License: LGPLv2+
URL: http://www.freedesktop.org/wiki/Software/PulseAudio
%if 0%{?gitrel}
@ -55,8 +55,13 @@ Patch201: pulseaudio-autostart.patch
Patch206: pulseaudio-11.1-autospawn_disable.patch
## upstream patches
Patch207: 0001-alsa-ucm-correct-the-channel-default-logic-stereo.patch
Patch208: 0002-alsa-ucm-do-not-assign-JackHWMute-when-JackControl-i.patch
Patch209: 0003-ucm-Don-t-log-errors-during-normal-operation.patch
Patch210: 0004-bluetooth-Ensure-that-only-one-A2DP-codec-is-registe.patch
## upstreamable patches
Patch211: 0005-alsa-handle-unavailbale-HW-volume-in-UCM.patch
BuildRequires: automake libtool
BuildRequires: gcc-c++
@ -253,6 +258,11 @@ This package contains GDM integration hooks for the PulseAudio sound server.
%if 0%{?systemd}
%patch206 -p1 -b .autospawn_disable
%endif
%patch207 -p1 -b .0007
%patch208 -p1 -b .0008
%patch209 -p1 -b .0009
%patch210 -p1 -b .0010
%patch211 -p1 -b .0011
sed -i.no_consolekit -e \
's/^load-module module-console-kit/#load-module module-console-kit/' \
@ -644,6 +654,10 @@ systemctl --no-reload preset --global pulseaudio.socket >/dev/null 2>&1 || :
%changelog
* Fri Mar 20 2020 Wim Taymans <wtaymans@redhat.com> - 13.99.1-2
- Add some more UCM patches
- Fix missing UCM mixers crash (#1815437)
* Fri Feb 14 2020 Rex Dieter <rdieter@fedoraproject.org> - 13.99.1-1
- 13.99.1