[pulseaudio-discuss] [PATCH] card: Only set active_profile with available profile

Luiz Augusto von Dentz luiz.dentz at gmail.com
Wed Oct 30 11:58:03 CET 2013


From: Luiz Augusto von Dentz <luiz.von.dentz at intel.com>

If the profile available flag is set to PA_AVAILABLE_NO it means the
profile shall not be use.
---
 src/pulsecore/card.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index e6e0836..ba2222e 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -195,9 +195,13 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
             c->save_profile = data->save_profile;
 
     if (!c->active_profile) {
-        PA_HASHMAP_FOREACH(profile, c->profiles, state)
+        PA_HASHMAP_FOREACH(profile, c->profiles, state) {
+            if (profile->available == PA_AVAILABLE_NO)
+                continue;
+
             if (!c->active_profile || profile->priority > c->active_profile->priority)
                 c->active_profile = profile;
+        }
     }
 
     c->userdata = NULL;
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list