mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
card: Ensure we still pick a profile even if it's unavailable.
f434087e42 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.
This commit is contained in:
parent
e9d760b555
commit
84af39f289
1 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue