[pulseaudio-discuss] [PATCH 1/9] role-cork: Don't ignore streams without media.role

Georg Chini georg at chini.tk
Thu Mar 26 13:54:17 PDT 2015


When corking do not ignore streams without media.role. Instead treat
them as if media.role="no_role", so that you can specify "no_role" as
trigger or cork role.
---
 src/modules/module-role-cork.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/modules/module-role-cork.c b/src/modules/module-role-cork.c
index 7c0f59f..ee7a9c8 100644
--- a/src/modules/module-role-cork.c
+++ b/src/modules/module-role-cork.c
@@ -77,7 +77,7 @@ static bool shall_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore) {
             continue;
 
         if (!(role = pa_proplist_gets(j->proplist, PA_PROP_MEDIA_ROLE)))
-            continue;
+           role = "no_role";
 
         PA_IDXSET_FOREACH(trigger_role, u->trigger_roles, role_idx) {
             if (pa_streq(role, trigger_role)) {
@@ -107,7 +107,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in
             continue;
 
         if (!(role = pa_proplist_gets(j->proplist, PA_PROP_MEDIA_ROLE)))
-            continue;
+           role = "no_role";
 
         PA_IDXSET_FOREACH(cork_role, u->cork_roles, role_idx) {
             if ((trigger = pa_streq(role, cork_role)))
@@ -152,7 +152,6 @@ static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, bo
 
 static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool create) {
     bool cork = false;
-    const char *role;
 
     pa_assert(u);
     pa_sink_input_assert_ref(i);
@@ -160,9 +159,6 @@ static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool creat
     if (!create)
         pa_hashmap_remove(u->cork_state, 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