[pulseaudio-discuss] [PATCH] alsa-mixer: Make sure unsupported paths are removed after probing

David Henningsson david.henningsson at canonical.com
Thu Jan 19 01:26:37 PST 2012


Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
 src/modules/alsa/alsa-mixer.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 2802231..e1d79e6 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4219,6 +4219,24 @@ static snd_pcm_t* mapping_open_pcm(pa_alsa_mapping *m,
                               m->device_strings, dev_id, NULL, &try_ss,
                               &try_map, mode, &try_period_size,
                               &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(
@@ -4316,6 +4334,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