[PATCH] role-cork: Fix improper uncork behavior in case of operating globally

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix improper uncork behavior when using this module with "global=1" argument.

Signed-off-by: Sangchul Lee <sc11.lee at samsung.com>
---
 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;
-- 
2.1.4



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux