Accepting request 809156 from multimedia:libs

OBS-URL: https://build.opensuse.org/request/show/809156
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/pulseaudio?expand=0&rev=169
This commit is contained in:
Dominique Leuenberger 2020-06-02 12:33:20 +00:00 committed by Git OBS Bridge
commit 3260975e1b
10 changed files with 443 additions and 0 deletions

View File

@ -0,0 +1,80 @@
From 5d70f1226b9046d814a8efe4b00453b68805e34c Mon Sep 17 00:00:00 2001
From: Tanu Kaskinen <tanuk@iki.fi>
Date: Fri, 14 Feb 2020 11:01:04 +0200
Subject: [PATCH] alsa: Document that mixer elements can be identified by a
combination of name and index
---
src/modules/alsa/mixer/paths/analog-output.conf.common | 3 ++-
src/modules/alsa/mixer/profile-sets/default.conf | 6 ++++--
src/modules/alsa/module-alsa-sink.c | 2 +-
src/modules/alsa/module-alsa-source.c | 2 +-
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/modules/alsa/mixer/paths/analog-output.conf.common b/src/modules/alsa/mixer/paths/analog-output.conf.common
index e52830d990ed..7bf346346fe3 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-output.conf.common
@@ -85,7 +85,8 @@
; required-any = ignore | enumeration | any # In this element, either this or another option must exist (or an element)
; required-absent = ignore | enumeration | any # In this element, this option must not exist or the path will be invalid
;
-; [Element ...] # For each element that we shall control
+; [Element ...] # For each element that we shall control. The "..." here is the element name,
+; # or name and index separated by a comma.
; required = ignore | switch | volume | enumeration | any # If set, require this element to be of this kind and available,
; # otherwise don't consider this path valid for the card
; required-any = ignore | switch | volume | enumeration | any # If set, at least one of the elements or jacks with required-any in this
diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf
index 34c51bc5bf0a..c73bf5cea33f 100644
--- a/src/modules/alsa/mixer/profile-sets/default.conf
+++ b/src/modules/alsa/mixer/profile-sets/default.conf
@@ -49,7 +49,8 @@
; # If multiple are found to be working they will be available as device ports
; paths-output = ...
; element-input = ... # Instead of configuring a full mixer path simply configure a single
-; # mixer element for volume/mute handling
+; # mixer element for volume/mute handling. The value can be an element
+; # name, or name and index separated by a comma.
; element-output = ...
; priority = ...
; direction = any | input | output # Only useful for?
@@ -72,7 +73,8 @@
; [DecibelFix element] # Decibel fixes can be used to work around missing or incorrect dB
; # information from alsa. A decibel fix is a table that maps volume steps
; # to decibel values for one volume element. The "element" part in the
-; # section title is the name of the volume element.
+; # section title is the name of the volume element (or name and index
+; # separated by a comma).
; #
; # NOTE: This feature is meant just as a help for figuring out the correct
; # decibel values. PulseAudio is not the correct place to maintain the
diff --git a/src/modules/alsa/module-alsa-sink.c b/src/modules/alsa/module-alsa-sink.c
index 4d4beb3cd487..a90c5e493514 100644
--- a/src/modules/alsa/module-alsa-sink.c
+++ b/src/modules/alsa/module-alsa-sink.c
@@ -52,7 +52,7 @@ PA_MODULE_USAGE(
"tsched_buffer_size=<buffer size when using timer based scheduling> "
"tsched_buffer_watermark=<lower fill watermark> "
"ignore_dB=<ignore dB information from the device?> "
- "control=<name of mixer control> "
+ "control=<name of mixer control, or name and index separated by a comma> "
"rewind_safeguard=<number of bytes that cannot be rewound> "
"deferred_volume=<Synchronize software and hardware volume changes to avoid momentary jumps?> "
"deferred_volume_safety_margin=<usec adjustment depending on volume direction> "
diff --git a/src/modules/alsa/module-alsa-source.c b/src/modules/alsa/module-alsa-source.c
index 747ba934212e..d15228316e09 100644
--- a/src/modules/alsa/module-alsa-source.c
+++ b/src/modules/alsa/module-alsa-source.c
@@ -61,7 +61,7 @@ PA_MODULE_USAGE(
"tsched_buffer_size=<buffer size when using timer based scheduling> "
"tsched_buffer_watermark=<upper fill watermark> "
"ignore_dB=<ignore dB information from the device?> "
- "control=<name of mixer control>"
+ "control=<name of mixer control, or name and index separated by a comma>"
"deferred_volume=<Synchronize software and hardware volume changes to avoid momentary jumps?> "
"deferred_volume_safety_margin=<usec adjustment depending on volume direction> "
"deferred_volume_extra_delay=<usec adjustment to HW volume changes> "
--
2.16.4

View File

@ -0,0 +1,45 @@
From cabd387e26b5fe03661f4b894826c7c6b58d7efa Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 11 Feb 2020 10:54:16 +0100
Subject: [PATCH] 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 a57be6d22497..b7d2c5b9c51a 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.16.4

View File

@ -0,0 +1,31 @@
From 4da4670fdb9a09199fb5d3bfaee252b2f4f13128 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Sun, 1 Mar 2020 15:55:07 +0100
Subject: [PATCH] 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 b7d2c5b9c51a..8df24e7b51d7 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.16.4

View File

@ -0,0 +1,45 @@
From 9d36210beca09cc7a3841d09e5246d4b0000c52d Mon Sep 17 00:00:00 2001
From: Tanu Kaskinen <tanuk@iki.fi>
Date: Tue, 17 Mar 2020 09:26:57 +0200
Subject: [PATCH] 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 8df24e7b51d7..37cbafae51ee 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.16.4

View File

@ -0,0 +1,41 @@
From f3f16fe6df087e37f219fd829ae5f647c40fc456 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Fri, 20 Mar 2020 12:03:08 +0100
Subject: [PATCH] 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 042d4dfd9c89..65430caed902 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 104de4e266dd..c33f81e35c18 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.16.4

View File

@ -0,0 +1,27 @@
From 4dc73f5167f7d4c2cf1d3e9c8bb7c796f3a35a4e Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 25 Mar 2020 16:30:23 +0100
Subject: [PATCH] alsa-ucm: use the right profile name
Use the right profile name or else we could pass NULL to
pa_hashmap_get() and crash.
---
src/modules/alsa/alsa-ucm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index 37cbafae51ee..9d6456162c55 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -1315,7 +1315,7 @@ int pa_alsa_ucm_set_profile(pa_alsa_ucm_config *ucm, pa_card *card, const char *
/* select volume controls on ports */
PA_HASHMAP_FOREACH(port, card->ports, state) {
data = PA_DEVICE_PORT_DATA(port);
- data->path = pa_hashmap_get(data->paths, new_profile);
+ data->path = pa_hashmap_get(data->paths, profile);
}
return ret;
--
2.16.4

View File

@ -0,0 +1,83 @@
From fc5f263e594cf5ecb7034fb54dadb286d2b4a810 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 31 Mar 2020 13:24:36 +0200
Subject: [PATCH] ucm: fix the port / ucm device activation on boot
The UCM device must be activated using the pa_alsa_ucm_set_port()
call on boot (the sink creation time). In case when the
mixer controls are not defined for the application in the
UCM configuration, the mixer_handle is NULL.
Call the pa_alsa_ucm_set_port() before the mixer_handle check.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/modules/alsa/alsa-sink.c | 13 +++++++++----
src/modules/alsa/alsa-source.c | 13 +++++++++----
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 65430caed902..7048371e1832 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2138,6 +2138,15 @@ static int setup_mixer(struct userdata *u, bool ignore_dB) {
pa_assert(u);
+ /* This code is before the u->mixer_handle check, because if the UCM
+ * configuration doesn't specify volume or mute controls, u->mixer_handle
+ * will be NULL, but the UCM device enable sequence will still need to be
+ * executed. */
+ if (u->sink->active_port && u->ucm_context) {
+ if (pa_alsa_ucm_set_port(u->ucm_context, u->sink->active_port, true) < 0)
+ return -1;
+ }
+
if (!u->mixer_handle)
return 0;
@@ -2155,10 +2164,6 @@ static int setup_mixer(struct userdata *u, bool ignore_dB) {
} else {
pa_alsa_ucm_port_data *data;
- /* First activate the port on the UCM side */
- if (pa_alsa_ucm_set_port(u->ucm_context, u->sink->active_port, true) < 0)
- return -1;
-
data = PA_DEVICE_PORT_DATA(u->sink->active_port);
/* Now activate volume controls, if any */
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index c33f81e35c18..bf9e093b336a 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1844,6 +1844,15 @@ static int setup_mixer(struct userdata *u, bool ignore_dB) {
pa_assert(u);
+ /* This code is before the u->mixer_handle check, because if the UCM
+ * configuration doesn't specify volume or mute controls, u->mixer_handle
+ * will be NULL, but the UCM device enable sequence will still need to be
+ * executed. */
+ if (u->source->active_port && u->ucm_context) {
+ if (pa_alsa_ucm_set_port(u->ucm_context, u->source->active_port, false) < 0)
+ return -1;
+ }
+
if (!u->mixer_handle)
return 0;
@@ -1861,10 +1870,6 @@ static int setup_mixer(struct userdata *u, bool ignore_dB) {
} else {
pa_alsa_ucm_port_data *data;
- /* First activate the port on the UCM side */
- if (pa_alsa_ucm_set_port(u->ucm_context, u->source->active_port, false) < 0)
- return -1;
-
data = PA_DEVICE_PORT_DATA(u->source->active_port);
/* Now activate volume controls, if any */
--
2.16.4

View File

@ -0,0 +1,61 @@
From 5eb02e31a6de116395075f814123daaad424d5a4 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 31 Mar 2020 13:32:46 +0200
Subject: [PATCH] alsa sink/source: fix the mixer initialization
- remove duplicate mixer initialization in sink
- use the similar mixer initialization for source like for sink
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/modules/alsa/alsa-sink.c | 2 --
src/modules/alsa/alsa-source.c | 12 +++++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 7048371e1832..b5fc0cd93972 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2511,8 +2511,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
/* ALSA might tweak the sample spec, so recalculate the frame size */
frame_size = pa_frame_size(&ss);
- find_mixer(u, mapping, pa_modargs_get_value(ma, "control", NULL), ignore_dB);
-
pa_sink_new_data_init(&data);
data.driver = driver;
data.module = m;
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index bf9e093b336a..829216a8a1a1 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -2198,8 +2198,6 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
/* ALSA might tweak the sample spec, so recalculate the frame size */
frame_size = pa_frame_size(&ss);
- find_mixer(u, mapping, pa_modargs_get_value(ma, "control", NULL), ignore_dB);
-
pa_source_new_data_init(&data);
data.driver = driver;
data.module = m;
@@ -2254,10 +2252,14 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
goto fail;
}
- if (u->ucm_context)
+ if (u->ucm_context) {
pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, false, card, u->pcm_handle, ignore_dB);
- else if (u->mixer_path_set)
- pa_alsa_add_ports(&data, u->mixer_path_set, card);
+ find_mixer(u, mapping, pa_modargs_get_value(ma, "control", NULL), ignore_dB);
+ } else {
+ find_mixer(u, mapping, pa_modargs_get_value(ma, "control", NULL), ignore_dB);
+ if (u->mixer_path_set)
+ pa_alsa_add_ports(&data, u->mixer_path_set, card);
+ }
u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|(u->use_tsched ? PA_SOURCE_DYNAMIC_LATENCY : 0));
volume_is_set = data.volume_is_set;
--
2.16.4

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Wed May 13 10:14:20 CEST 2020 - tiwai@suse.de
- Backport upstream fixes for ALSA UCM profile handling
(boo#1171492):
0033-alsa-Document-that-mixer-elements-can-be-identified-.patch
0034-alsa-ucm-correct-the-channel-default-logic-stereo.patch
0035-alsa-ucm-do-not-assign-JackHWMute-when-JackControl-i.patch
0036-ucm-Don-t-log-errors-during-normal-operation.patch
0037-alsa-handle-unavailbale-HW-volume-in-UCM.patch
0038-alsa-ucm-use-the-right-profile-name.patch
0039-ucm-fix-the-port-ucm-device-activation-on-boot.patch
0040-alsa-sink-source-fix-the-mixer-initialization.patch
-------------------------------------------------------------------
Thu Apr 2 17:43:26 CEST 2020 - tiwai@suse.de

View File

@ -83,6 +83,14 @@ Patch1029: 0029-alsa-ucm-add-support-for-HDMI-ELD.patch
Patch1030: 0030-alsa-mixer-do-the-quick-card-number-lookup-to-save-m.patch
Patch1031: 0031-alsa-mixer-improve-check-for-the-empty-path-set-for-.patch
Patch1032: 0032-alsa-ucm-allow-to-set-profile-priority-from-UCM-valu.patch
Patch1033: 0033-alsa-Document-that-mixer-elements-can-be-identified-.patch
Patch1034: 0034-alsa-ucm-correct-the-channel-default-logic-stereo.patch
Patch1035: 0035-alsa-ucm-do-not-assign-JackHWMute-when-JackControl-i.patch
Patch1036: 0036-ucm-Don-t-log-errors-during-normal-operation.patch
Patch1037: 0037-alsa-handle-unavailbale-HW-volume-in-UCM.patch
Patch1038: 0038-alsa-ucm-use-the-right-profile-name.patch
Patch1039: 0039-ucm-fix-the-port-ucm-device-activation-on-boot.patch
Patch1040: 0040-alsa-sink-source-fix-the-mixer-initialization.patch
BuildRequires: alsa-devel >= 1.0.19
BuildRequires: bluez-devel >= 5
BuildRequires: doxygen
@ -403,6 +411,14 @@ Optional dependency offering zsh completion for various PulseAudio utilities
%patch1030 -p1
%patch1031 -p1
%patch1032 -p1
%patch1033 -p1
%patch1034 -p1
%patch1035 -p1
%patch1036 -p1
%patch1037 -p1
%patch1038 -p1
%patch1039 -p1
%patch1040 -p1
%patch1 -p1
%patch2
%patch5