[pulseaudio-discuss] understanding PA cork/uncorking scenarios

Himanshu Chug himanshu.chug at gmail.com
Thu Jun 16 02:39:29 PDT 2011


Thanks Tanu for the clarifications.

But the doubt is still , who is actually sending the pause(cork) event to
pulsesink or gst, either or both of these:
1. module-x11-cork-request with X11 keyboard events
2. src/pulsecore/protocol-native.has sink_input_send_event_cb(),

and where these event is handled in pulsesink (and gst)?  as
gst_pulsering_stream_event_cb( ) is disabled with flag HAVE_PULSE_0_9_15, So
I guess
this event is handled somewhere else,but not sure where?


I am getting one bug, where pulse-audio daemon is terminated, the usecase
is:

1. "phone" stream is ongoing
2. "music" stream arrives,

so expected behavior is music should get corked while phone is active,
eventually its getting corked sometimes and working fine but not always!
and sometimes PA daemon gets terminated saying Failed to handle SIGBUS, here
are few gst logs when starting "music" stream from gst-launch:

ERROR: from element
/GstPlayBin2:playbin20/GstPlaySink:playsink0/GstBin:abin/GstBin:bin0/GstPulseSink:pulsesink0:
pa_stream_write() failed: Connection terminated
Additional debug info:
pulsesink.c(1587): gst_pulseringbuffer_commit ():
/GstPlayBin2:playbin20/GstPlaySink:playsink0/GstBin:abin/GstBin:bin0/GstPulseSink:pulsesink0
Execution ended after 75439452 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
/GstPlayBin2:playbin20/GstPlaySink:playsink0/GstBin:abin/GstBin:bin0/GstPulseSink:pulsesink0.GstPad:sink:
caps = NULL
Assertion 'pa_atomic_load(&(b)->_ref) > 0' failed at
pulsecore/memblock.c:590, function pa_memblock_unref(). Aborting.
Aborted


I doubt this issue is related to my earlier question, as you mentioned
"module-x11-cork-request is a workaround for clients that don't handle
stream events (a workaround that isn't working very well, I've heard) "?

BR,
Himanshu



On Thu, Jun 16, 2011 at 1:47 PM, Tanu Kaskinen <tanuk at iki.fi> wrote:

> On Thu, 2011-06-16 at 12:54 +0530, Himanshu Chug wrote:
> > Hi
> >
> > I am trying to understand how the corking/uncorking events reach from PA
> > module to PA applications/clients e.g gst-launch
> >
> > Say, we are corking the playback stream in module-cork-music-on-phone by
> > calling :
> >
> > apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore,
> pa_bool_t
> > cork)
> >      pa_sink_input_send_event(ignore, PA_STREAM_EVENT_REQUEST_CORK,
> NULL);
> > (in sink-input.c)
> >
> > (pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_SEND_EVENT],
> > &hook_data)   (function then fire an hook)
> >                       sink_input_send_event_hook_cb( pa_core *c,
> > pa_sink_input_send_event_hook_data *data, struct userdata *u)    ( in
> > module-x11-cork-request, passing *data that contains cork event)
> >
> >
> > now inside sink_input_send_event_hook_cb( )   ( in
> module-x11-cork-request )
> > there is an if-else check
> >
> >     if (pa_streq(data->event, PA_STREAM_EVENT_REQUEST_CORK))
> >         sym = XF86XK_AudioPause;
> >     else if (pa_streq(data->event, PA_STREAM_EVENT_REQUEST_UNCORK))
> >         sym = XF86XK_AudioPlay;
> >     else
> >         return PA_HOOK_OK;
> >
> > further the same function is calling
> >     XTestFakeKeyEvent(display, code, True, CurrentTime);
> >     XSync(display, False);
>
> module-x11-cork-request is a workaround for clients that don't handle
> stream events (a workaround that isn't working very well, I've heard).
> As can be seen from the code you pasted, the idea is to generate
> AudioPause and AudioPlay X11 keyboard events with the hope that the
> applications will handle those.
>
> > But it is not clear to me how the Cork/Uncork events then reach to PA
> client
> > (say pulsesink or Gst-launch)
>
> src/pulsecore/protocol-native.c has sink_input_send_event_cb(), which
> sends all stream events over the protocol to the client. It's then up to
> the client to decide what to do.
>
> > and then where gst listens to these events and
> > pause / resume gst pipeline accordingly ?
> > Is pulsesink involved here somehow ? I can see
> > gst_pulsering_stream_event_cb( )  function (inside pulsesink.c)  handling
> > PA_STREAM_EVENT_REQUEST_CORK but currently it is under #ifdef
> > HAVE_PULSE_0_9_15 flag and disabled.
>
> That's the function that should handle the cork request and pause the
> Gstreamer pipeline. If the code is disabled, then Pulseaudio's stream
> events apparently are not currently handled by Gstreamer.
>
> --
> Tanu
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110616/2ed64fe7/attachment.html>


More information about the pulseaudio-discuss mailing list