<div dir="ltr">OK, after some debugging I've come across a comment in gsturidecodebin.c that led me to this bug:<div><a href="https://bugzilla.gnome.org/show_bug.cgi?id=632782">https://bugzilla.gnome.org/show_bug.cgi?id=632782</a><br>
</div><div><br></div><div style>Looks like instantiating live elements through type-finding either does not work or at least it's racy.</div><div style>If this is all true and if there are any ideas of fixing it, I'd be tempted to have a look and tinker a little bit with it.</div>
<div style><br></div><div style>Cheers,</div><div style>Kris</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/3/28 Krzysztof Konopko <span dir="ltr"><<a href="mailto:krzysztof.konopko@youview.com" target="_blank">krzysztof.konopko@youview.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Interestingly /decodebin2/ does not propagate instantiated element's<br>
GstStateChangeReturn return value as it's a type-found signal callback.<br>
gst-plugin-base/gst/playback/gstdecodebin2.c:connect_pad():<br>
<br>
/* Bring the element to the state of the parent */<br>
    if ((gst_element_set_state (element,<br>
                GST_STATE_PAUSED)) == GST_STATE_CHANGE_FAILURE) {<br>
<br>
so no way to say there will be no pre-roll.<br>
<br>
Does it make any sense to try to instantiate a live element through<br>
typfinding?<br>
<br>
Cheers,<br>
Kris<br>
<div><div class="h5"><br>
On 11/01/13 17:05, Krzysztof Konopko wrote:<br>
> Hi,<br>
><br>
> I had a closer look into it. The problem can be reduced to something<br>
> like this (hope you don't mind if I rehash some bits of previous<br>
> description):<br>
><br>
> gst-launch-1.0 \<br>
>   uridecodebin uri=file:///tmp/test.sdp caps=video/mpegts \<br>
>   ! fakesink<br>
><br>
> On my laptop it doesn't matter whether it's a genuine HTTP or filesystem<br>
> request. It deadlocks.<br>
><br>
><br>
> There's a custom vqesdpdemux element which has application/sdp<br>
> capability on its sink. Here's how the gist of the problem goes:<br>
><br>
> 1. uridecodebin instantiates filesrc, queue2 and vqesdpdemux (typefinder<br>
> magic)<br>
><br>
> 2. vqesdpdemux receives data (buffers) from filesrc until it gets EOS<br>
> event on its sink pad (receives SDP content, simple text file)<br>
><br>
> 3. In the same thread were the EOS event was received vqesdpdemux<br>
> (GstBin) creates a genuine custom vqesrc element which is supposed to<br>
> receive the RTP traffic<br>
><br>
> 4. The new vqesrc element's state is synchronised with its parent<br>
> (vqesdpdemux) by calling gst_element_sync_state_with_parent() but this<br>
> can "trap" it in PAUSED or READY state (depends how far in the<br>
> transition the pipeline got after sending EOS).<br>
><br>
> Now because vqesrc is a *live* element, it's activated pad thread waits<br>
> in gst_base_src_wait_playing() for vqesrc to get into PLAYING. But it<br>
> won't transition to that state if it's "trapped" in pipeline's<br>
> transition towards READY (depending on timing conditions).<br>
><br>
><br>
><br>
> I'll be digging into it (*) but if it bells with anyone, please shout.<br>
><br>
> Basically we're looking for (or trying to find/understand) a good<br>
> pattern to create a new source element somewhere in the *middle* of the<br>
> pipeline based on some information (buffers) already received and<br>
> potentially ditch/replace (lop off) the old bit of upstream (if<br>
> possible) after it's done its job.<br>
><br>
> It works pretty well if the source is explicit (e. g. filesrc). Things<br>
> get complicated if one wants to use typefind magic and<br>
> auto-instantiating/connecting (some decodebin element).<br>
><br>
> Cheers,<br>
> Kris<br>
><br>
> (*) It's a quite involving piece of work to looking into. I'm not doing<br>
> it because I'm magnanimous but because Mariusz is sitting almost next to<br>
> me :)<br>
><br>
> On 07/01/13 17:57, Mariusz Buras wrote:<br>
>> Hi all,<br>
>><br>
>> I have a quite complex problem to describe so first I'll show you my<br>
>> pipeline setup:<br>
>><br>
>>    uridecodebin uri=<a href="http://some_address_somewhere.co.uk/test.sdp" target="_blank">http://some_address_somewhere.co.uk/test.sdp</a><br>
>> caps=video/mpegts<br>
>>        ! queue ! tsdemux ! video/x-h264 ! decodebin ! queue ! xvimagesink<br>
>><br>
>> Where "test.sdp" is an SDP file which refers to a multicast RTP stream.<br>
>>   I have created an element "vqesrc"[1] which is a live source for this<br>
>> multicast RTP data.  It takes the contents of an SDP file as a property.<br>
>>   To get it to be autoplugged by decodebin I have also created<br>
>> vqesdpdemux which handles "application/sdp" caps much like hlsdemux or<br>
>> sdpdemux works.<br>
>><br>
>> vqesdpdemux is a bin.  It creates a vqesrc, adds it to itself, sets the SDP<br>
>> file data as a one of the properties of vqesrc and adds a ghost pad on<br>
>> vqesdpdemux exposing the source pad of the gstvqesrc to outside of the<br>
>> bin. So when everything works I should be getting something like that on<br>
>> the diagram[2].  As you can see everything gets autoplugged as expected<br>
>> and I indeed can see live video on my screen. I have also attached a log<br>
>> file that shows what's going on when it works [3].<br>
>><br>
>> In vqesdpdemux when I create the vqesrc child element (which is a live<br>
>> source) I am careful to call gst_element_sync_state_with_parent for the<br>
>> child.  Also I am careful to return GST_STATE_CHANGE_NO_PREROLL from<br>
>> vqesdpdemux whenever a request to enter state PAUSED is received as I<br>
>> know the child I will be adding will be live.<br>
>><br>
>><br>
>> The problem starts when uridecodebin is pointed to a locally stored SDP<br>
>> file, something like this:<br>
>><br>
>>    uridecodebin uri=file:///home/mariusz.buras/tmp/test.sdp<br>
>> caps=video/mpegts<br>
>>      ! queue ! tsdemux ! video/x-h264 ! decodebin  ! queue ! xvimagesink<br>
>><br>
>> Basically, what seems to happen is that my pipeline never fully enters<br>
>> PAUSED state (only vqesdpdemux does) and gets stuck in READY forever.<br>
>> As shown in [4] pipeline start to preroll but never finishes.  My<br>
>> experiments showed that in "http case" SDP file is delivered while the<br>
>> pipline is changing it's state to PLAYING. While in the "broken" case<br>
>> it's delivered when the pipeline is transitioning to the PAUSED state.<br>
>> This leads me to believe that something wrong happens (or something good<br>
>> doesn't happen) when vqesdpdemux receives a sink event callback with a<br>
>> buffer containing the SDP file.<br>
>><br>
>> What I have tried to fix/mitigate the problem*:<br>
>><br>
>> 1. Forcing vqesrc element state to PLAYING just after it's added to<br>
>> vqesdpdemux bin with gst_set_state rather than<br>
>> gst_element_sync_state_with_parent. This makes it work, but I don't<br>
>> think this is a right thing to do.  It makes me a bit uneasy using  a<br>
>> half baked "fix" to a problem I don't understand.<br>
>> 2. Sending a reconfigure event. Doesn't help.<br>
>> 3. Delaying the creation of vqesrc element - this doesn't work.<br>
>> 4. Plenty of weird/desperate hacks on vqesdpdemux - same result.<br>
>><br>
>> * when I write that "it doesn't work" I mean that it behaves in the same<br>
>> or very similar fashion to when the "fix" wasn't applied.<br>
>><br>
>> I've also attached [5] a diagram of the last state the pipeline gets<br>
>> into when it doesn't work. This is not very helpful though, because<br>
>> the last state my pipeline fully enters is READY when no auto-plugging<br>
>> happened yet.<br>
>><br>
>><br>
>> I think possibly what is happening is that the pipeline is prerolling in<br>
>> the PAUSED state so vqesrc doesn't produce any data so the pipeline<br>
>> never exits the prerolling state so makes it to state PLAYING but then<br>
>> I'm unsure why it would work with the http case but not with local file.<br>
>><br>
>><br>
>> Can someone help me with that?<br>
>><br>
>> Regards,<br>
>> Mariusz.<br>
>><br>
>><br>
>> [1] The code for both of these can be found on github:<br>
>> <a href="https://github.com/sqward/gst-vqe" target="_blank">https://github.com/sqward/gst-vqe</a><br>
>> [2] An example working pipeline attached as "example_working_pipeline.jpg"<br>
>> [3] An example working log attached as "example_working_log.txt"<br>
>> [4] Log of a broken case attached as "broken_case.txt"<br>
>> [5] A diagram of "broken" pipeline when it gets stuck in READY state<br>
>> attached as "broken_case.png"<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> gstreamer-devel mailing list<br>
>> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
>> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
>><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
><br>
<br>
</div></div>This transmission contains information that may be confidential and contain personal views which are not necessarily those of YouView TV Ltd. YouView TV Ltd (Co No:7308805) is a limited liability company registered in England and Wales with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower Thames Street, London, EC3R 6YT. For details see our web site at <a href="http://www.youview.com" target="_blank">http://www.youview.com</a><br>

<br>
<br>
</blockquote></div><br></div>