[pulseaudio-discuss] Should corking be acknowledged by pa_sink_suspend()?

Arun Raghavan arun at accosted.net
Wed Nov 5 01:57:22 PST 2014


On 5 November 2014 15:04, Ville Sundell <ville.sundell at nomovok.com> wrote:
> 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.

Not sure what code base this is, but this policy enforcement is not
part of PulseAudio upstream. I guess this comes from Nemo or Tizen?

Either way, there seems to be some confusion between concepts here.
The idea of corking applies to sink inputs (pa_sink_input on the
server side, pa_stream on the client side). The idea of being
suspended applies to sinks (pa_sink). Could you explain your problem
again, and what the symptoms are, keeping this in mind?

> 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;
> }

Just to reiterate, s->state will be from the pa_sink_state_t enum,
whereas PA_SINK_INPUT_CORKED comes from the pa_sink_input_state_t enum.

Cheers,
Arun


More information about the pulseaudio-discuss mailing list