Hi Colin<br><br>I did further debugging for the use-case, music over phone i.e<br><br>1. "phone" stream is ongoing<br>2. "music" stream arrives,<br><br>I observed that the music stream is never corked , I assumed that it was working sometimes but actually the music stream gets "muted" just before call to cork, as seen in this code from module-cork-music-on-phone.c in apply_cork() function:<br>
<br> if (cork && !corked) {<br> pa_hashmap_put(u->cork_state, ignore, PA_INT_TO_PTR(1));<br> pa_sink_input_set_mute(ignore, TRUE, FALSE);<br> pa_sink_input_send_event(ignore, PA_STREAM_EVENT_REQUEST_CORK, NULL);<br>
return;<br> }<br><br>when I commented pa_sink_input_set_mute() , stream got mixed with phone !!! and I assumed that the use-case is working fine sometimes!!! sad!<br><br>which means that as you mention for "PA_STREAM_START_CORKED flag... streams, when connecting can say "Please start me corked"<br>
have this problem always and this is a bug in the code. ?? which might needs to be handle somehow..gracefully.<br><br>any comments are welcome?<br><br>Best Regards,<br>Himanshu<br><br><br><br><div class="gmail_quote">On Fri, Jun 17, 2011 at 2:28 PM, Colin Guthrie <span dir="ltr"><<a href="mailto:gmane@colin.guthr.ie">gmane@colin.guthr.ie</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">'Twas brillig, and Himanshu Chug at 16/06/11 10:39 did gyre and gimble:<br>
<div class="im">> Thanks Tanu for the clarifications.<br>
><br>
> But the doubt is still , who is actually sending the pause(cork) event<br>
> to pulsesink or gst, either or both of these:<br>
> 1. module-x11-cork-request with X11 keyboard events<br>
> 2. src/pulsecore/protocol-native.has sink_input_send_event_cb(),<br>
<br>
</div>The latter. Both former is listening for the cork requests on streams.<br>
<br>
e.g. in module-x11-cork-request (which I very much think you should<br>
ignore completely and disable in any install as it just gets in the way<br>
and results in very strange behaviour due to non-stateful tracking of<br>
the current state... e.g. by default if a Skype call comes in when you<br>
have e.g. Amarok paused, then Amarok will unpause for you when the call<br>
starts and pause again then it ends... the exact opposite of what you<br>
want!), there is this hook:<br>
<br>
u->hook_slot = pa_hook_connect(<br>
&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_SEND_EVENT],<br>
PA_HOOK_NORMAL,<br>
(pa_hook_cb_t) sink_input_send_event_hook_cb, u);<br>
<br>
<br>
So the function sink_input_send_event_hook_cb(), is what listens for<br>
corks and then takes appropriate action (sending synthesised keystrokes).<br>
<br>
<br>
Now the "event" sending stuff is quite generic, with cork and uncork<br>
just examples of the kind of events we currently support. Other events<br>
may include "supported formats changed" (e.g. if you move an mp3<br>
passthrough stream to a sink that does not support mp3 passthrough - the<br>
client has to be informed so they can take appropriate action to do the<br>
decode themselves and start delivering PCM data instead).<br>
<br>
<br>
So this is the call but it needs to be triggered by something e.g. in<br>
module-cork-music-on-phone:<br>
<br>
pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_CORK, NULL);<br>
<br>
Here it's ultimately using the protocol native<br>
sink_input_send_event_cb() function to send the request to the client,<br>
but the trigger starts with the above call.<br>
<div class="im"><br>
> and where these event is handled in pulsesink (and gst)? as<br>
> gst_pulsering_stream_event_cb( ) is disabled with flag<br>
> HAVE_PULSE_0_9_15, So I guess<br>
> this event is handled somewhere else,but not sure where?<br>
<br>
</div>We covered this in my last reply. HAVE_PULSE_0_9_15 is defined :)<br>
<div class="im"><br>
> I am getting one bug, where pulse-audio daemon is terminated, the<br>
> usecase is:<br>
><br>
> 1. "phone" stream is ongoing<br>
> 2. "music" stream arrives,<br>
><br>
> so expected behavior is music should get corked while phone is active,<br>
> eventually its getting corked sometimes and working fine but not always!<br>
<br>
<br>
</div>Ahh, interesting... yeah, this is perhaps due to the START_CORKED<br>
flag... streams, when connecting can say "Please start me corked" in<br>
this case, the client will specifically uncork the music stream at the<br>
beginning of playback... Hmm, not quite sure how to deal with this.....<br>
<div class="im"><br>
<br>
> and sometimes PA daemon gets terminated saying Failed to handle SIGBUS,<br>
> here are few gst logs when starting "music" stream from gst-launch:<br>
><br>
> ERROR: from element<br>
> /GstPlayBin2:playbin20/GstPlaySink:playsink0/GstBin:abin/GstBin:bin0/GstPulseSink:pulsesink0:<br>
> pa_stream_write() failed: Connection terminated<br>
> Additional debug info:<br>
> pulsesink.c(1587): gst_pulseringbuffer_commit ():<br>
> /GstPlayBin2:playbin20/GstPlaySink:playsink0/GstBin:abin/GstBin:bin0/GstPulseSink:pulsesink0<br>
> Execution ended after 75439452 ns.<br>
> Setting pipeline to PAUSED ...<br>
> Setting pipeline to READY ...<br>
> /GstPlayBin2:playbin20/GstPlaySink:playsink0/GstBin:abin/GstBin:bin0/GstPulseSink:pulsesink0.GstPad:sink:<br>
> caps = NULL<br>
> Assertion 'pa_atomic_load(&(b)->_ref) > 0' failed at<br>
> pulsecore/memblock.c:590, function pa_memblock_unref(). Aborting.<br>
> Aborted<br>
<br>
</div>Ouch. Not sure how best to debug that one.<br>
<div class="im"><br>
> I doubt this issue is related to my earlier question, as you mentioned<br>
> "module-x11-cork-request is a workaround for clients that don't handle<br>
> stream events (a workaround that isn't working very well, I've heard) "?<br>
<br>
</div>Yeah, I've disabled x11-cork-request in my packages for a long time and<br>
generally recommend others to do the same.<br>
<br>
In fact I thought I had disabled it in git master's<br>
start-pulseaudio-x11, but it seems I didn't. I remember asking about<br>
this to gauge a consensus... but can't find anything on the list... I'll<br>
ask again.<br>
<div class="im"><br>
Col<br>
<br>
<br>
--<br>
<br>
Colin Guthrie<br>
gmane(at)<a href="http://colin.guthr.ie" target="_blank">colin.guthr.ie</a><br>
<a href="http://colin.guthr.ie/" target="_blank">http://colin.guthr.ie/</a><br>
<br>
Day Job:<br>
Tribalogic Limited [<a href="http://www.tribalogic.net/" target="_blank">http://www.tribalogic.net/</a>]<br>
Open Source:<br>
Mageia Contributor [<a href="http://www.mageia.org/" target="_blank">http://www.mageia.org/</a>]<br>
PulseAudio Hacker [<a href="http://www.pulseaudio.org/" target="_blank">http://www.pulseaudio.org/</a>]<br>
Trac Hacker [<a href="http://trac.edgewall.org/" target="_blank">http://trac.edgewall.org/</a>]<br>
<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">pulseaudio-discuss mailing list<br>
<a href="mailto:pulseaudio-discuss@lists.freedesktop.org">pulseaudio-discuss@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss" target="_blank">http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss</a><br>
</div></div></blockquote></div><br>