mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
acp: prefer some other profile than Off
The Off profile is always available but we should only use it as the ultimate fallback when all other profiles are NO. Fixes #309
This commit is contained in:
parent
a97287351c
commit
d13181fb37
1 changed files with 6 additions and 3 deletions
|
|
@ -623,10 +623,11 @@ static void init_eld_ctls(pa_card *impl)
|
||||||
uint32_t acp_card_find_best_profile_index(struct acp_card *card, const char *name)
|
uint32_t acp_card_find_best_profile_index(struct acp_card *card, const char *name)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t best, best2, best3;
|
uint32_t best, best2, best3, off;
|
||||||
struct acp_card_profile **profiles = card->profiles;
|
struct acp_card_profile **profiles = card->profiles;
|
||||||
|
|
||||||
best = best2 = best3 = ACP_INVALID_INDEX;
|
best = best2 = best3 = ACP_INVALID_INDEX;
|
||||||
|
off = 0;
|
||||||
|
|
||||||
for (i = 0; i < card->n_profiles; i++) {
|
for (i = 0; i < card->n_profiles; i++) {
|
||||||
struct acp_card_profile *p = profiles[i];
|
struct acp_card_profile *p = profiles[i];
|
||||||
|
|
@ -636,7 +637,9 @@ uint32_t acp_card_find_best_profile_index(struct acp_card *card, const char *nam
|
||||||
best = i;
|
best = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (p->available == ACP_AVAILABLE_YES) {
|
if (p->flags & ACP_PROFILE_OFF) {
|
||||||
|
off = i;
|
||||||
|
} else if (p->available == ACP_AVAILABLE_YES) {
|
||||||
if (best == ACP_INVALID_INDEX || p->priority > profiles[best]->priority)
|
if (best == ACP_INVALID_INDEX || p->priority > profiles[best]->priority)
|
||||||
best = i;
|
best = i;
|
||||||
} else if (p->available != ACP_AVAILABLE_NO) {
|
} else if (p->available != ACP_AVAILABLE_NO) {
|
||||||
|
|
@ -652,7 +655,7 @@ uint32_t acp_card_find_best_profile_index(struct acp_card *card, const char *nam
|
||||||
if (best == ACP_INVALID_INDEX)
|
if (best == ACP_INVALID_INDEX)
|
||||||
best = best3;
|
best = best3;
|
||||||
if (best == ACP_INVALID_INDEX)
|
if (best == ACP_INVALID_INDEX)
|
||||||
best = 0;
|
best = off;
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue