<div dir="auto">That is correct actually.  Do a get_state to wait for the state change to complete.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 7, 2019, 1:25 AM Ian Davidson <<a href="mailto:id012c3076@blueyonder.co.uk">id012c3076@blueyonder.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is a guess.<br>
<br>
I suspect that step 8 (setting the state to NULL) may take some time to <br>
complete.  Does it raise a signal when the state changes? If you set the <br>
state to NULL and then blindly go ahead and unref things you are hoping <br>
that the state change will have completed quickly.  So, sometimes, you <br>
will 'get away with it' and sometimes you will crash.<br>
<br>
Ian<br>
<br>
<br>
On 06/09/19 23:45, Olivier Crête wrote:<br>
> Hi,<br>
><br>
> You don't need a separate gmainloop per pipeline, you can use the same one for all of them. They'll all use the default main context. So you do steps 3 & 6 only once.<br>
><br>
> Olivier<br>
><br>
> On September 6, 2019 4:32:41 p.m. EDT, Ben Rush <<a href="mailto:ben@ben-rush.net" target="_blank" rel="noreferrer">ben@ben-rush.net</a>> wrote:<br>
>> I have a need to put multiple video windows in a single application.<br>
>> This<br>
>> means multiple pipelines. For example, the RTSP URL is different for<br>
>> each<br>
>> player, and so I get a new pipeline for each invocation<br>
>> of gst_parse_launch.<br>
>><br>
>> I can share code, but in general: what is the best way to do this? The<br>
>> way<br>
>> I'm doing this now (for EACH player I've instantiated in the SAME app):<br>
>><br>
>> 1) gst_parse_launch, get back the pipeline,<br>
>> 2) gst_pipeline_get_bus, to create a bus on this pipeline.<br>
>> 3) g_main_loop_new(NULL, FALSE) to create a new loop (this is where my<br>
>> main<br>
>> question is at)<br>
>> 4) gst_bus_add_watch to create an add watch on this pipeline,<br>
>> 5) gst_element_set_state to set my pipeline state to GST_STATE_PLAYING<br>
>> 6) g_main_loop_run on the loop returned from #3<br>
>> 7) Then I play until a stop is issued....<br>
>> 8) gst_element_set_state(pipeline, GST_STATE_NULL)<br>
>> 9) unref the bus,<br>
>> 10) unref the pipeline<br>
>> 11) unref the loop<br>
>><br>
>> I ask about this order, and the fact I'm creating a new loop without an<br>
>> independent context because I'm getting some random crashes in my app<br>
>> hosting multiple players, and it appears to be during tear down. In<br>
>> general, is this pattern acceptable, or have I committed a sin<br>
>> somewhere?<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></blockquote></div>