Greetings everyone!
I am having some problems with corking: pulseaudio policy enforcer will cork all the streams which belongs to a corked group. However, despite the fact corking itself happens correctly (via pa_sink_input_cork() at pulseaudio-policy-enforcement:src/policy-group.c) the stream will not end up being corked, instead it will be set to PA_SINK_RUNNING.

After some tracing, it seems that it happens because of sink_set_state() is called from pa_sink_suspend() (at pulseaudio:src/pulsecore/sink.c) right after the corking. The end of the function is:

    if (s->suspend_cause)
        return sink_set_state(s, PA_SINK_SUSPENDED);
    else
return sink_set_state(s, pa_sink_used_by(s) ? PA_SINK_RUNNING : PA_SINK_IDLE);
}

Should it be something like:

    if (s->suspend_cause)
        return sink_set_state(s, PA_SINK_SUSPENDED);
    else if (s->state != PA_SINK_INPUT_CORKED)
return sink_set_state(s, pa_sink_used_by(s) ? PA_SINK_RUNNING : PA_SINK_IDLE);
    else
        return 0;
}

...to take corking into account? This fix proposal is also attached to this e-mail as a patch.

Best regards,
Ville Sundell
Author: Ville Sundell <ville.sund...@nomovok.com>
Date:   Tue Nov 4 19:51:17 2014 +0200

    pa_sink_suspend() can now handle corked streams.
    
    Corking should be taken into account when trying to suspend a stream. After this patch pa_sink_suspend() will return 0 if the stream in question is corked,

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 46b6eec..a8d84e5 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -875,8 +875,10 @@ int pa_sink_suspend(pa_sink *s, bool suspend, pa_suspend_cause_t cause) {
 
     if (s->suspend_cause)
         return sink_set_state(s, PA_SINK_SUSPENDED);
-    else
+    else if (s->state != PA_SINK_INPUT_CORKED)
         return sink_set_state(s, pa_sink_used_by(s) ? PA_SINK_RUNNING : PA_SINK_IDLE);
+    else
+        return 0;
 }
 
 /* Called from main context */

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to