[pulseaudio-discuss] [PATCH] role-ducking: Don't ignore streams without media.role

Georg Chini georg at chini.tk
Fri Mar 20 12:36:35 PDT 2015


When ducking do not ignore streams without media.role. Instead treat
them as if media.role="not_set", so that you can specify "not_set" as
trigger or ducking role.

---
 src/modules/module-role-ducking.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/modules/module-role-ducking.c b/src/modules/module-role-ducking.c
index 4f9be10..dbc9086 100644
--- a/src/modules/module-role-ducking.c
+++ b/src/modules/module-role-ducking.c
@@ -83,7 +83,7 @@ static bool sink_has_trigger_streams(struct userdata *u, pa_sink *s, pa_sink_inp
             continue;
 
         if (!(role = pa_proplist_gets(j->proplist, PA_PROP_MEDIA_ROLE)))
-            continue;
+           role = "not_set";
 
         PA_IDXSET_FOREACH(trigger_role, u->trigger_roles, role_idx) {
             if (pa_streq(role, trigger_role)) {
@@ -113,7 +113,7 @@ static void apply_ducking_to_sink(struct userdata *u, pa_sink *s, pa_sink_input
             continue;
 
         if (!(role = pa_proplist_gets(j->proplist, PA_PROP_MEDIA_ROLE)))
-            continue;
+           role = "not_set";
 
         PA_IDXSET_FOREACH(ducking_role, u->ducking_roles, role_idx) {
             if ((trigger = pa_streq(role, ducking_role)))
@@ -152,14 +152,10 @@ static void apply_ducking(struct userdata *u, pa_sink *s, pa_sink_input *ignore,
 
 static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool duck) {
     bool should_duck = false;
-    const char *role;
 
     pa_assert(u);
     pa_sink_input_assert_ref(i);
 
-    if (!(role = pa_proplist_gets(i->proplist, PA_PROP_MEDIA_ROLE)))
-        return PA_HOOK_OK;
-
     if (!i->sink)
         return PA_HOOK_OK;
 
-- 
2.1.4



More information about the pulseaudio-discuss mailing list