Takashi Iwai
5dabf3bcba
- Backport upstream fixes / enhancements about alsa modules: mainly for UCM support (boo#1160914): 0001-alsa-mixer-path-test-Hide-unused-functions-when-buil.patch 0002-alsa-mixer-recognize-the-Speaker-Jack-control.patch 0003-alsa-mixer-add-support-for-SteelSeries-Arctis-Pro-20.patch 0004-alsa-mixer-Add-support-for-SteelSeries-Arctis-5-2019.patch 0005-alsa-mixer-add-support-for-LucidSound-LS31-and-creat.patch 0006-alsa-ucm-use-ucm2-name-for-the-direct-card-index-ope.patch 0007-alsa-ucm-add-mixer-IDs-to-ucm_items.patch 0008-alsa-mixer-handle-the-index-for-ALSA-mixer-element-i.patch 0009-alsa-mixer-improve-alsa_id_decode-function.patch 0010-alsa-ucm-Support-Playback-CaptureVolume.patch 0011-alsa-ucm-Fix-volume-control-based-on-review.patch 0012-alsa-ucm-use-the-correct-mixer-identifiers-as-first.patch 0013-alsa-ucm-add-support-for-master-volume.patch 0014-alsa-ucm-split-correctly-JackHWMute-device-names.patch 0015-alsa-ucm-fix-parsing-for-JackControl.patch 0016-alsa-ucm-add-comments-to-ucm_get_mixer_id.patch 0017-alsa-ucm-validate-access-to-PA_DEVICE_PORT_DATA.patch 0018-alsa-Skip-resume-PCM-if-hardware-doesn-t-support-it.patch 0019-alsa-ucm-parse-correctly-the-device-values.patch 0020-alsa-ucm-do-not-try-to-use-UCM-device-name-as-jack-n.patch 0021-alsa-util-do-not-try-to-guess-the-mixer-name-from-th.patch 0022-alsa-ucm-add-control-and-mixer-device-items.patch 0023-alsa-ucm-get-the-mixer-names-from-ucm-don-t-guess.patch 0024-alsa-ucm-use-the-proper-mixer-name-for-ucm-pcm-sink-.patch 0025-alsa-mixer-handle-interface-type-CARD-PCM-for-mixer-.patch 0026-alsa-mixer-Add-the-ability-to-pass-the-intended-role.patch 0027-alsa-mixer-Set-the-intended-role-of-Steelseries-Arct.patch 0028-alsa-rewrite-mixer-open-close-cache-mixer-accesses-i.patch OBS-URL: https://build.opensuse.org/request/show/774841 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pulseaudio?expand=0&rev=217
135 lines
5.0 KiB
Diff
135 lines
5.0 KiB
Diff
From d7dbd0cbe3191661c02ac89d108b36c79474de3c Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Kysela <perex@perex.cz>
|
|
Date: Sun, 8 Dec 2019 23:17:32 +0100
|
|
Subject: [PATCH] alsa-mixer: improve check for the empty path set for
|
|
sink/source
|
|
|
|
The unused mixer instances are created without this code.
|
|
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
src/modules/alsa/alsa-mixer.c | 6 ++++++
|
|
src/modules/alsa/alsa-mixer.h | 1 +
|
|
src/modules/alsa/alsa-sink.c | 19 +++++++++++++------
|
|
src/modules/alsa/alsa-source.c | 9 ++++++---
|
|
4 files changed, 26 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
|
|
index a3c998b654e9..d184aec7aee7 100644
|
|
--- a/src/modules/alsa/alsa-mixer.c
|
|
+++ b/src/modules/alsa/alsa-mixer.c
|
|
@@ -741,6 +741,12 @@ void pa_alsa_path_set_free(pa_alsa_path_set *ps) {
|
|
pa_xfree(ps);
|
|
}
|
|
|
|
+int pa_alsa_path_set_is_empty(pa_alsa_path_set *ps) {
|
|
+ if (ps && !pa_hashmap_isempty(ps->paths))
|
|
+ return 0;
|
|
+ return 1;
|
|
+}
|
|
+
|
|
static long to_alsa_dB(pa_volume_t v) {
|
|
return lround(pa_sw_volume_to_dB(v) * 100.0);
|
|
}
|
|
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
|
|
index d740a78c8dce..df739cc2e0f3 100644
|
|
--- a/src/modules/alsa/alsa-mixer.h
|
|
+++ b/src/modules/alsa/alsa-mixer.h
|
|
@@ -272,6 +272,7 @@ pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t d
|
|
void pa_alsa_path_set_dump(pa_alsa_path_set *s);
|
|
void pa_alsa_path_set_set_callback(pa_alsa_path_set *ps, snd_mixer_t *m, snd_mixer_elem_callback_t cb, void *userdata);
|
|
void pa_alsa_path_set_free(pa_alsa_path_set *s);
|
|
+int pa_alsa_path_set_is_empty(pa_alsa_path_set *s);
|
|
|
|
struct pa_alsa_mapping {
|
|
pa_alsa_profile_set *profile_set;
|
|
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
|
|
index 363b4be2fa25..042d4dfd9c89 100644
|
|
--- a/src/modules/alsa/alsa-sink.c
|
|
+++ b/src/modules/alsa/alsa-sink.c
|
|
@@ -1651,7 +1651,6 @@ static int sink_set_port_ucm_cb(pa_sink *s, pa_device_port *p) {
|
|
|
|
pa_assert(u);
|
|
pa_assert(p);
|
|
- pa_assert(u->mixer_handle);
|
|
pa_assert(u->ucm_context);
|
|
|
|
data = PA_DEVICE_PORT_DATA(p);
|
|
@@ -2089,6 +2088,9 @@ static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char
|
|
if (!mapping && !element)
|
|
return;
|
|
|
|
+ if (!element && mapping && pa_alsa_path_set_is_empty(mapping->output_path_set))
|
|
+ return;
|
|
+
|
|
u->mixers = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func,
|
|
NULL, (pa_free_cb_t) pa_alsa_mixer_free);
|
|
|
|
@@ -2113,8 +2115,9 @@ static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char
|
|
|
|
pa_log_debug("Probed mixer path %s:", u->mixer_path->name);
|
|
pa_alsa_path_dump(u->mixer_path);
|
|
- } else if (!(u->mixer_path_set = mapping->output_path_set))
|
|
- goto fail;
|
|
+ } else {
|
|
+ u->mixer_path_set = mapping->output_path_set;
|
|
+ }
|
|
|
|
return;
|
|
|
|
@@ -2559,10 +2562,14 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
|
|
goto fail;
|
|
}
|
|
|
|
- if (u->ucm_context)
|
|
+ if (u->ucm_context) {
|
|
pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, true, 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->sink = pa_sink_new(m->core, &data, PA_SINK_HARDWARE | PA_SINK_LATENCY | (u->use_tsched ? PA_SINK_DYNAMIC_LATENCY : 0) |
|
|
(set_formats ? PA_SINK_SET_FORMATS : 0));
|
|
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
|
|
index b46e845cc5a7..104de4e266dd 100644
|
|
--- a/src/modules/alsa/alsa-source.c
|
|
+++ b/src/modules/alsa/alsa-source.c
|
|
@@ -1522,7 +1522,6 @@ static int source_set_port_ucm_cb(pa_source *s, pa_device_port *p) {
|
|
|
|
pa_assert(u);
|
|
pa_assert(p);
|
|
- pa_assert(u->mixer_handle);
|
|
pa_assert(u->ucm_context);
|
|
|
|
data = PA_DEVICE_PORT_DATA(p);
|
|
@@ -1795,6 +1794,9 @@ static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char
|
|
if (!mapping && !element)
|
|
return;
|
|
|
|
+ if (!element && mapping && pa_alsa_path_set_is_empty(mapping->input_path_set))
|
|
+ return;
|
|
+
|
|
u->mixers = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func,
|
|
NULL, (pa_free_cb_t) pa_alsa_mixer_free);
|
|
|
|
@@ -1819,8 +1821,9 @@ static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char
|
|
|
|
pa_log_debug("Probed mixer path %s:", u->mixer_path->name);
|
|
pa_alsa_path_dump(u->mixer_path);
|
|
- } else if (!(u->mixer_path_set = mapping->input_path_set))
|
|
- goto fail;
|
|
+ } else {
|
|
+ u->mixer_path_set = mapping->input_path_set;
|
|
+ }
|
|
|
|
return;
|
|
|
|
--
|
|
2.16.4
|
|
|