mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
alsa, bluetooth: fail if user-requested profile doesn't exist
If we can't fulfill the user request fully, I think we shouldn't fulfill it at all, to make it clear that the requested operation didn't succeed.
This commit is contained in:
parent
87f437d0dd
commit
59e76ca949
2 changed files with 14 additions and 4 deletions
|
|
@ -807,8 +807,15 @@ int pa__init(pa_module *m) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL)))
|
if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
|
||||||
|
if (pa_hashmap_get(data.profiles, profile))
|
||||||
pa_card_new_data_set_profile(&data, profile);
|
pa_card_new_data_set_profile(&data, profile);
|
||||||
|
else {
|
||||||
|
pa_log("No such profile: %s", profile);
|
||||||
|
pa_card_new_data_done(&data);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u->card = pa_card_new(m->core, &data);
|
u->card = pa_card_new(m->core, &data);
|
||||||
pa_card_new_data_done(&data);
|
pa_card_new_data_done(&data);
|
||||||
|
|
|
||||||
|
|
@ -2301,8 +2301,11 @@ static int add_card(struct userdata *u) {
|
||||||
if ((default_profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
|
if ((default_profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
|
||||||
if (pa_hashmap_get(data.profiles, default_profile))
|
if (pa_hashmap_get(data.profiles, default_profile))
|
||||||
pa_card_new_data_set_profile(&data, default_profile);
|
pa_card_new_data_set_profile(&data, default_profile);
|
||||||
else
|
else {
|
||||||
pa_log_warn("Profile '%s' not valid or not supported by device.", default_profile);
|
pa_log("Profile '%s' not valid or not supported by device.", default_profile);
|
||||||
|
pa_card_new_data_done(&data);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u->card = pa_card_new(u->core, &data);
|
u->card = pa_card_new(u->core, &data);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue