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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux