mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
card-restore: don't switch profiles when availability changes
module-card-restore should only restore the initial state of new cards, but profile_available_changed_callback() changed the profile whenever the saved profile became available. That caused interference with module-bluetooth-policy, which also sets card profiles based on the availability changes. The original reason for having this code was to work around the problem that bluetooth cards used to be created with only one profile available, and other profiles would become available soon after the card creation. Now the bluetooth card creation is delayed until all profiles are available, so this bad workaround can be removed. Discussion: https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-August/026575.html
This commit is contained in:
parent
d9b885e0f1
commit
c538bc7aa4
1 changed files with 0 additions and 32 deletions
|
|
@ -479,36 +479,6 @@ static pa_hook_result_t card_profile_added_callback(pa_core *c, pa_card_profile
|
|||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
static pa_hook_result_t profile_available_changed_callback(void *hook_data, void *call_data, void *userdata) {
|
||||
pa_card_profile *profile = call_data;
|
||||
pa_card *card;
|
||||
struct userdata *u = userdata;
|
||||
struct entry *entry;
|
||||
|
||||
pa_assert(profile);
|
||||
pa_assert(u);
|
||||
|
||||
card = profile->card;
|
||||
|
||||
if (profile->available == PA_AVAILABLE_NO)
|
||||
return PA_HOOK_OK;
|
||||
|
||||
entry = entry_read(u, card->name);
|
||||
if (!entry)
|
||||
return PA_HOOK_OK;
|
||||
|
||||
if (!pa_streq(profile->name, entry->profile)) {
|
||||
entry_free(entry);
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
pa_log_info("Card %s profile %s became available, activating.", card->name, profile->name);
|
||||
pa_card_set_profile(profile->card, profile, true);
|
||||
|
||||
entry_free(entry);
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
static pa_hook_result_t port_offset_change_callback(pa_core *c, pa_device_port *port, struct userdata *u) {
|
||||
struct entry *entry;
|
||||
pa_card *card;
|
||||
|
|
@ -654,8 +624,6 @@ int pa__init(pa_module*m) {
|
|||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_PREFERRED_PORT_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) card_preferred_port_changed_callback, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) card_profile_changed_callback, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_PROFILE_ADDED], PA_HOOK_NORMAL, (pa_hook_cb_t) card_profile_added_callback, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_PROFILE_AVAILABLE_CHANGED],
|
||||
PA_HOOK_NORMAL, profile_available_changed_callback, u);
|
||||
pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) port_offset_change_callback, u);
|
||||
|
||||
if (!(fname = pa_state_path("card-database", true)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue