[PATCH 1/4] card: Ensure we still pick a profile even if it's unavailable.

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

 



f434087e42b introduced the potential to not select a card profile if
all the profiles were marked as unavailable.

While this is very unlikely, it's a theoretical posibility, so if the
initial choice of a profile fails, try harder.
---
 src/pulsecore/card.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index 4ae16c2..03c0bb6 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -202,6 +202,12 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
             if (!c->active_profile || profile->priority > c->active_profile->priority)
                 c->active_profile = profile;
         }
+        /* If all profiles are not available, then we still need to pick one */
+        if (!c->active_profile) {
+            PA_HASHMAP_FOREACH(profile, c->profiles, state)
+                if (!c->active_profile || profile->priority > c->active_profile->priority)
+                    c->active_profile = profile;
+        }
         pa_assert(c->active_profile);
     }
 
-- 
1.8.4.3



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

  Powered by Linux