mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
filter-heuristics: Match roles correctly
This commit is contained in:
parent
8460466f86
commit
fd14a9af35
1 changed files with 23 additions and 2 deletions
|
|
@ -54,8 +54,29 @@ struct userdata {
|
||||||
*source_output_move_finish_slot;
|
*source_output_move_finish_slot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static pa_bool_t role_match(pa_proplist *proplist, const char *role) {
|
||||||
|
const char *ir;
|
||||||
|
char *r;
|
||||||
|
const char *state = NULL;
|
||||||
|
|
||||||
|
if (!(ir = pa_proplist_gets(proplist, PA_PROP_DEVICE_INTENDED_ROLES)))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
while ((r = pa_split_spaces(ir, &state))) {
|
||||||
|
|
||||||
|
if (pa_streq(role, r)) {
|
||||||
|
pa_xfree(r);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pa_xfree(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_sink_input) {
|
static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_sink_input) {
|
||||||
const char *want, *int_role, *stream_role;
|
const char *want, *stream_role;
|
||||||
pa_proplist *pl, *parent_pl;
|
pa_proplist *pl, *parent_pl;
|
||||||
|
|
||||||
if (is_sink_input) {
|
if (is_sink_input) {
|
||||||
|
|
@ -78,7 +99,7 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_s
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On phone sinks, make sure we're not applying echo cancellation */
|
/* On phone sinks, make sure we're not applying echo cancellation */
|
||||||
if ((int_role = pa_proplist_gets(parent_pl, PA_PROP_DEVICE_INTENDED_ROLES)) && strstr(int_role, "phone")) {
|
if (role_match(parent_pl, "phone")) {
|
||||||
const char *apply = pa_proplist_gets(pl, PA_PROP_FILTER_APPLY);
|
const char *apply = pa_proplist_gets(pl, PA_PROP_FILTER_APPLY);
|
||||||
|
|
||||||
if (apply && pa_streq(apply, "echo-cancel")) {
|
if (apply && pa_streq(apply, "echo-cancel")) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue