From 9c4013651fc2e0ba2499fdb8d21cc222e2b7b4a1 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Mon, 23 Sep 2013 22:02:31 +0200 Subject: [PATCH] Backport a patch for pulseaudio crash at startup This fixes an issue with jack detection code that led to assertion failures at startup, depending on the hardware configuration. https://bugzilla.redhat.com/show_bug.cgi?id=1000966 http://lists.freedesktop.org/archives/pulseaudio-discuss/2013-September/018741.html --- ...all-unused-paths-not-only-unsupporte.patch | 111 ++++++++++++++++++ pulseaudio.spec | 6 + 2 files changed, 117 insertions(+) create mode 100644 0001-alsa-mixer-Drop-all-unused-paths-not-only-unsupporte.patch diff --git a/0001-alsa-mixer-Drop-all-unused-paths-not-only-unsupporte.patch b/0001-alsa-mixer-Drop-all-unused-paths-not-only-unsupporte.patch new file mode 100644 index 0000000..76032fd --- /dev/null +++ b/0001-alsa-mixer-Drop-all-unused-paths-not-only-unsupporte.patch @@ -0,0 +1,111 @@ +From c07cf2017076cf00fa344f6fc7d188bbba06dc28 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Mon, 23 Sep 2013 14:00:57 +0200 +Subject: [PATCH] alsa-mixer: Drop all unused paths, not only unsupported paths + +This is a cleaner solution, because it also removes paths that are +being removed because they are subsets of other paths. + +Otherwise, the lingering paths could cause jack detection related +assertion failures. + +BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=69676 +Reported-and-tested-by: Kalev Lember +Signed-off-by: David Henningsson +--- + src/modules/alsa/alsa-mixer.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c +index 71dfa79..95c7628 100644 +--- a/src/modules/alsa/alsa-mixer.c ++++ b/src/modules/alsa/alsa-mixer.c +@@ -3748,7 +3748,7 @@ fail: + } + + static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, +- pa_alsa_direction_t direction) { ++ pa_alsa_direction_t direction, pa_hashmap *used_paths) { + + pa_alsa_path *p; + void *state; +@@ -3793,6 +3793,9 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, + if (mixer_handle) + snd_mixer_close(mixer_handle); + ++ PA_HASHMAP_FOREACH(p, ps->paths, state) ++ pa_hashmap_put(used_paths, p, p); ++ + pa_log_debug("Available mixer paths (after tidying):"); + pa_alsa_path_set_dump(ps); + } +@@ -4281,16 +4284,18 @@ static snd_pcm_t* mapping_open_pcm(pa_alsa_mapping *m, + &try_buffer_size, 0, NULL, NULL, true); + } + +-static void paths_drop_unsupported(pa_hashmap* h) { ++static void paths_drop_unused(pa_hashmap* h, pa_hashmap *keep) { + + void* state = NULL; + const void* key; + pa_alsa_path* p; + + pa_assert(h); ++ pa_assert(keep); ++ + p = pa_hashmap_iterate(h, &state, &key); + while (p) { +- if (p->supported <= 0) { ++ if (pa_hashmap_get(keep, p) == NULL) { + pa_hashmap_remove(h, key); + pa_alsa_path_free(p); + } +@@ -4308,7 +4313,7 @@ void pa_alsa_profile_set_probe( + void *state; + pa_alsa_profile *p, *last = NULL; + pa_alsa_mapping *m; +- pa_hashmap *broken_inputs, *broken_outputs; ++ pa_hashmap *broken_inputs, *broken_outputs, *used_paths; + + pa_assert(ps); + pa_assert(dev_id); +@@ -4319,6 +4324,7 @@ void pa_alsa_profile_set_probe( + + broken_inputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); + broken_outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); ++ used_paths = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); + + PA_HASHMAP_FOREACH(p, ps->profiles, state) { + uint32_t idx; +@@ -4406,12 +4412,12 @@ void pa_alsa_profile_set_probe( + if (p->output_mappings) + PA_IDXSET_FOREACH(m, p->output_mappings, idx) + if (m->output_pcm) +- mapping_paths_probe(m, p, PA_ALSA_DIRECTION_OUTPUT); ++ mapping_paths_probe(m, p, PA_ALSA_DIRECTION_OUTPUT, used_paths); + + if (p->input_mappings) + PA_IDXSET_FOREACH(m, p->input_mappings, idx) + if (m->input_pcm) +- mapping_paths_probe(m, p, PA_ALSA_DIRECTION_INPUT); ++ mapping_paths_probe(m, p, PA_ALSA_DIRECTION_INPUT, used_paths); + } + + /* Clean up */ +@@ -4419,10 +4425,11 @@ void pa_alsa_profile_set_probe( + + pa_alsa_profile_set_drop_unsupported(ps); + +- paths_drop_unsupported(ps->input_paths); +- paths_drop_unsupported(ps->output_paths); ++ paths_drop_unused(ps->input_paths, used_paths); ++ paths_drop_unused(ps->output_paths, used_paths); + pa_hashmap_free(broken_inputs); + pa_hashmap_free(broken_outputs); ++ pa_hashmap_free(used_paths); + + ps->probed = true; + } +-- +1.8.3.1 + diff --git a/pulseaudio.spec b/pulseaudio.spec index feb114e..708b891 100644 --- a/pulseaudio.spec +++ b/pulseaudio.spec @@ -26,6 +26,10 @@ Source1: default.pa-for-gdm ## upstream patches +# https://bugzilla.redhat.com/show_bug.cgi?id=1000966 +# http://lists.freedesktop.org/archives/pulseaudio-discuss/2013-September/018741.html +Patch0: 0001-alsa-mixer-Drop-all-unused-paths-not-only-unsupporte.patch + BuildRequires: m4 BuildRequires: libtool-ltdl-devel BuildRequires: intltool @@ -198,6 +202,7 @@ This package contains GDM integration hooks for the PulseAudio sound server. %prep %setup -q -T -b0 -n %{name}-%{version}%{?gitrel:-%{gitrel}-g%{shortcommit}} +%patch0 -p1 sed -i.no_consolekit -e \ 's/^load-module module-console-kit/#load-module module-console-kit/' \ @@ -477,6 +482,7 @@ exit 0 %changelog * Mon Sep 23 2013 Kalev Lember - 4.0-4.gita89ca - Update to today's git snapshot +- Backport a patch for pulseaudio crash at startup (#1000966) * Thu Aug 15 2013 Kalev Lember - 4.0-3.gitbf9b3 - Update to git snapshot bf9b3f0 for BlueZ 5 support