[pulseaudio-discuss] [PATCH] alsa-mixer: Make sure unsupported paths are removed after probing
David Henningsson
david.henningsson at canonical.com
Thu Jan 19 01:30:31 PST 2012
Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
Slightly more readable this time.
src/modules/alsa/alsa-mixer.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 2802231..265a5e9 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4221,6 +4221,23 @@ 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) {
+
+ void* state = NULL;
+ const void* key;
+ pa_alsa_path* p;
+
+ pa_assert(h);
+ p = pa_hashmap_iterate(h, &state, &key);
+ while (p) {
+ if (p->supported <= 0) {
+ pa_hashmap_remove(h, key);
+ pa_alsa_path_free(p);
+ }
+ p = pa_hashmap_iterate(h, &state, &key);
+ }
+}
+
void pa_alsa_profile_set_probe(
pa_alsa_profile_set *ps,
const char *dev_id,
@@ -4316,6 +4333,9 @@ void pa_alsa_profile_set_probe(
mapping_free(m);
}
+ paths_drop_unsupported(ps->input_paths);
+ paths_drop_unsupported(ps->output_paths);
+
ps->probed = TRUE;
}
--
1.7.8.3
More information about the pulseaudio-discuss
mailing list