mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-02-25 01:40:32 -05:00
Pass the profile object instead of the profile name to pa_card_set_profile()
When setting attribute foo, or in this case the card profile, in my opinion the thing passed to the set_foo() function should be of the type of foo, not a string identifier that can be used to search for the actual foo in set_foo(). This is mostly a question of taste, but there's at least some small benefit from passing the actual object: often the profile object is already available when calling pa_card_set_profile(), so passing the card name would cause unnecessary searching when pa_card_set_profile() needs to look up the profile from the hashmap.
This commit is contained in:
parent
bee86af3cc
commit
ce304d6208
12 changed files with 38 additions and 24 deletions
|
|
@ -413,7 +413,7 @@ static pa_hook_result_t card_profile_added_callback(pa_core *c, pa_card_profile
|
|||
return PA_HOOK_OK;
|
||||
|
||||
if (pa_safe_streq(entry->profile, profile->name)) {
|
||||
if (pa_card_set_profile(profile->card, profile->name, true) >= 0)
|
||||
if (pa_card_set_profile(profile->card, profile, true) >= 0)
|
||||
pa_log_info("Restored profile '%s' for card %s.", profile->name, profile->card->name);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue