summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangchul Lee <sangchul1011@gmail.com>2016-02-11 23:11:21 +0900
committerArun Raghavan <git@arunraghavan.net>2016-02-18 15:09:14 +0530
commitd049c2941e6aef5ff33bcd0b4adece12289302b7 (patch)
treee58221155781d7601a27906e495f4e96185d3ac5
parent3977a906e21fe215051c0a82cf951cc12080fbb1 (diff)
role-ducking: Fix improper unducking behavior in case of operating globally
Fix improper unducking behavior when using this module with "global=1" argument. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93994 Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
-rw-r--r--src/modules/module-role-ducking.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/modules/module-role-ducking.c b/src/modules/module-role-ducking.c
index 4f9be1032..ee31b8cc9 100644
--- a/src/modules/module-role-ducking.c
+++ b/src/modules/module-role-ducking.c
@@ -96,6 +96,22 @@ static bool sink_has_trigger_streams(struct userdata *u, pa_sink *s, pa_sink_inp
return false;
}
+static bool sinks_have_trigger_streams(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 = sink_has_trigger_streams(u, s, ignore)))
+ break;
+ } else
+ ret = sink_has_trigger_streams(u, s, ignore);
+
+ return ret;
+}
+
static void apply_ducking_to_sink(struct userdata *u, pa_sink *s, pa_sink_input *ignore, bool duck) {
pa_sink_input *j;
uint32_t idx, role_idx;
@@ -163,7 +179,7 @@ static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool duck)
if (!i->sink)
return PA_HOOK_OK;
- should_duck = sink_has_trigger_streams(u, i->sink, duck ? NULL : i);
+ should_duck = sinks_have_trigger_streams(u, i->sink, duck ? NULL : i);
apply_ducking(u, i->sink, duck ? NULL : i, should_duck);
return PA_HOOK_OK;