From b02276019aad589209d15aa84df9d6211794b909 Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Fri, 5 Feb 2016 08:43:42 +0900 Subject: [PATCH] role-cork: Fix improper uncork behavior in case of operating globally Fix improper uncork behavior when using this module with "global=1" argument. Signed-off-by: Sangchul Lee --- src/modules/module-role-cork.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/modules/module-role-cork.c b/src/modules/module-role-cork.c index 7c0f59f..7a4a0c0 100644 --- a/src/modules/module-role-cork.c +++ b/src/modules/module-role-cork.c @@ -90,6 +90,22 @@ static bool shall_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore) { return false; } +static bool shall_corks(struct userdata *u, pa_sink *s, pa_sink_input *ignore) { + bool ret = false; + + pa_assert(u); + + if (u->global) { + uint32_t idx; + PA_IDXSET_FOREACH(s, u->core->sinks, idx) + if ((ret = shall_cork(u, s, ignore))) + break; + } else + ret = shall_cork(u, s, ignore); + + return ret; +} + static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_input *ignore, bool cork) { pa_sink_input *j; uint32_t idx, role_idx; @@ -166,7 +182,7 @@ static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool creat if (!i->sink) return PA_HOOK_OK; - cork = shall_cork(u, i->sink, create ? NULL : i); + cork = shall_corks(u, i->sink, create ? NULL : i); apply_cork(u, i->sink, create ? NULL : i, cork); return PA_HOOK_OK; -- 1.9.1