<div dir="ltr"><div dir="ltr"><p class="MsoNormal">Hello all,<span></span></p>

<p class="MsoNormal"><span> </span></p>

<p class="MsoNormal">I am trying a program with a dynamic pipeline.<span></span></p>

<p class="MsoNormal">In this program, an appsink data branch will be linked and
unlinked to the tee dynamically.<span></span></p>

<p class="MsoNormal">The pipeline looks like:<span></span></p>

<p class="MsoNormal">                                                              /  queue --- fakesink<span></span></p>

<p class="MsoNormal">videotestsrc --- x264enc --- tee ---<span></span></p>

<p class="MsoNormal">                                                       
      \  queue --- appsink<span></span></p>

<p class="MsoNormal"><span> </span></p><p class="MsoNormal">At the beginning
of the program, there is only the fakesink data branch.</p><p class="MsoNormal">Then another
thread is created and does the following process periodically:</p><p class="MsoNormal">1. If the appsink branch is not linked, the thread
will create elements and link them to the tee.</p><p class="gmail-MsoListParagraphCxSpFirst" style=""><span></span></p>

<p class="gmail-MsoListParagraphCxSpLast" style="">2.<span style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"Times New Roman""> </span>If the appsink branch is linked, the thread will
unlink them from the tee and release elements.<span></span></p>

<p class="MsoNormal"><span> </span></p>

<p class="MsoNormal">When unlinking the appsink branch, I set the queue and
appsink to GST_STATE_NULL before removing them from the pipeline:<span></span></p>

<p class="MsoNormal">gst_element_set_state(queue_appsink, GST_STATE_NULL);<span></span></p>

<p class="MsoNormal">gst_element_set_state(appsink, GST_STATE_NULL);<span></span></p>

<p class="MsoNormal">gst_bin_remove_many(GST_BIN(pipeline), queue_appsink,
appsink, NULL);<span></span></p>

<p class="MsoNormal"><span> </span></p><p class="MsoNormal">However, GStreamer
complains the states of elements are not NULL when disposing them randomly…</p><p class="MsoNormal">e.g.:</p><p class="MsoNormal">Trying to dispose
element queue10, but it is in PLAYING instead of the NULL state.</p><p class="MsoNormal">Trying to dispose
element appsink9, but it is in READY instead of the NULL state.</p><p class="MsoNormal"><br></p><p class="MsoNormal">This example  can be run and reproduce this problem: <a href="https://dci2l49av9uew.cloudfront.net/gst_test.cpp">https://dci2l49av9uew.cloudfront.net/gst_test.cpp</a></p><p class="MsoNormal"><br></p><p class="MsoNormal">Would anyone help
to figure out how I can fix this problem?</p><p class="MsoNormal">Thanks for your
help</p><p class="MsoNormal"><br></p><p class="MsoNormal" style="margin-left:0.5in"><span></span></p></div></div>