[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v1.0-dev-150-gdda564f

Colin Guthrie gitmailer-noreply at 0pointer.de
Sat Mar 12 05:12:03 PST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  e2df84497629d61706c455ed2829db0bebb7e5a5 (commit)

- Log -----------------------------------------------------------------
dda564f cork-on-phone: Only cork (and subsequently uncork) streams that are not already corked.
-----------------------------------------------------------------------

Summary of changes:
 src/modules/module-cork-music-on-phone.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

-----------------------------------------------------------------------

commit dda564f50b55340ff4bfbaa8d6d6fc6427f764f4
Author: Colin Guthrie <cguthrie at mandriva.org>
Date:   Thu Mar 10 11:11:51 2011 +0000

    cork-on-phone: Only cork (and subsequently uncork) streams that are not already corked.
    
    Although by "cork" I really mean "cork+mute" as that's what the module
    does.
    
    If e.g. Rhythmbox is paused when a phone call comes in, the current
    stream state will be corked and thus we should not track it for future
    uncorking when the phone call ends.
    
    Likewise if the stream is just muted (manually) we will not take any
    action either when the phone stream is seen first, nor when it
    disappears.
    
    Also add some additional debug messages.

diff --git a/src/modules/module-cork-music-on-phone.c b/src/modules/module-cork-music-on-phone.c
index d3a2b00..0731587 100644
--- a/src/modules/module-cork-music-on-phone.c
+++ b/src/modules/module-cork-music-on-phone.c
@@ -66,8 +66,10 @@ static pa_bool_t shall_cork(pa_sink *s, pa_sink_input *ignore) {
         if (!(role = pa_proplist_gets(j->proplist, PA_PROP_MEDIA_ROLE)))
             continue;
 
-        if (pa_streq(role, "phone"))
+        if (pa_streq(role, "phone")) {
+            pa_log_debug("Found a phone stream that will trigger the auto-cork.");
             return TRUE;
+        }
     }
 
     return FALSE;
@@ -81,7 +83,7 @@ static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, pa
     pa_sink_assert_ref(s);
 
     for (j = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); j; j = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
-        pa_bool_t corked;
+        pa_bool_t corked, muted, corked_here;
         const char *role;
 
         if (j == ignore)
@@ -94,18 +96,25 @@ static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, pa
             !pa_streq(role, "music"))
             continue;
 
-        corked = !!pa_hashmap_get(u->cork_state, j);
+        corked = (pa_sink_input_get_state(j) == PA_SINK_INPUT_CORKED);
+        muted = pa_sink_input_get_mute(j);
+        corked_here = !!pa_hashmap_get(u->cork_state, j);
 
-        if (cork && !corked) {
-            pa_hashmap_put(u->cork_state, j, PA_INT_TO_PTR(1));
+        if (cork && !corked && !muted) {
+            pa_log_debug("Found a music/video stream that should be corked/muted.");
+            if (!corked_here)
+                pa_hashmap_put(u->cork_state, j, PA_INT_TO_PTR(1));
             pa_sink_input_set_mute(j, TRUE, FALSE);
             pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_CORK, NULL);
         } else if (!cork) {
             pa_hashmap_remove(u->cork_state, j);
 
-            if (corked) {
-                pa_sink_input_set_mute(j, FALSE, FALSE);
-                pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_UNCORK, NULL);
+            if (corked_here && (corked || muted)) {
+                pa_log_debug("Found a music/video stream that should be uncorked/unmuted.");
+                if (muted)
+                    pa_sink_input_set_mute(j, FALSE, FALSE);
+                if (corked)
+                    pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_UNCORK, NULL);
             }
         }
     }

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list