mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
card: handle sticky profile flag
New card database entry version 5 for card profile is sticky flag. New messaging API handlers set-profile-sticky and get-profile-sticky. When card profile is sticky, always restore it even if it is unavailable, and prevent switching from it when ports become unavailable. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/568>
This commit is contained in:
parent
79cb1369fc
commit
e576bd924f
5 changed files with 133 additions and 5 deletions
|
|
@ -137,6 +137,11 @@ static int try_to_switch_profile(pa_device_port *port) {
|
|||
void *state;
|
||||
unsigned best_prio = 0;
|
||||
|
||||
if (port->card->profile_is_sticky) {
|
||||
pa_log_info("Keeping sticky card profile '%s'", port->card->active_profile->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pa_log_debug("Finding best profile for port %s, preferred = %s",
|
||||
port->name, pa_strnull(port->preferred_profile));
|
||||
|
||||
|
|
@ -391,6 +396,11 @@ static pa_hook_result_t card_profile_available_hook_callback(pa_core *c, pa_card
|
|||
if (!pa_streq(profile->name, card->active_profile->name))
|
||||
return PA_HOOK_OK;
|
||||
|
||||
if (card->profile_is_sticky) {
|
||||
pa_log_info("Keeping sticky card profile '%s'", profile->name);
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
pa_log_debug("Active profile %s on card %s became unavailable, switching to another profile", profile->name, card->name);
|
||||
pa_card_set_profile(card, find_best_profile(card), false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue