stream-interaction: Bugfix for improper uncorking behavior with global=1

This patch is based on a recent patch for module-role-ducking from Sangchul Lee
which fixes incorrect behavior when global is set to 1. Original commit can be found
here:
https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=d049c2941e6aef5ff33bcd0b4adece12289302b7
This commit is contained in:
Georg Chini 2016-03-17 22:35:05 +01:00 committed by Tanu Kaskinen
parent 71b128aaea
commit 4731690a21

View file

@ -84,6 +84,22 @@ static const char *find_trigger_stream(struct userdata *u, pa_sink *s, pa_sink_i
return NULL;
}
static const char *find_global_trigger_stream(struct userdata *u, pa_sink *s, pa_sink_input *ignore) {
const char *trigger_role = NULL;
pa_assert(u);
if (u->global) {
uint32_t idx;
PA_IDXSET_FOREACH(s, u->core->sinks, idx)
if ((trigger_role = find_trigger_stream(u, s, ignore)))
break;
} else
trigger_role = find_trigger_stream(u, s, ignore);
return trigger_role;
}
static void cork_stream(struct userdata *u, pa_sink_input *i, const char *interaction_role, const char *trigger_role) {
pa_log_debug("Found a '%s' stream that corks/mutes a '%s' stream.", trigger_role, interaction_role);
@ -190,7 +206,7 @@ static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool creat
if (!i->sink)
return PA_HOOK_OK;
trigger_role = find_trigger_stream(u, i->sink, create ? NULL : i);
trigger_role = find_global_trigger_stream(u, i->sink, create ? NULL : i);
apply_interaction(u, i->sink, trigger_role, create ? NULL : i);
return PA_HOOK_OK;