[gst-devel] How can I wait for the pipeline destruction?

Zhao, Halley halley.zhao at intel.com
Sat Apr 24 04:35:39 CEST 2010


Two solution:
1> send EOS to the src element of your pipeline, I used this for my camera src. (other src element may not support it well).
2> double check the previous pipeline has been destructed.
sc_ret = gst_element_gst_state(GST_ELEMENT(pipeline), &curr_state, ...);
loop=1
while(loop) {
  If(sc_ret == GST_STATE_CHANGE_SUCCESS || curr_state == GST_STATE_NULL) {
  ....
  Loop = 0;
  }
}

You can also use gst_bus_timed_pop_filtered to optimize the above loop.

-----Original Message-----
From: wl2776 [mailto:wl2776 at gmail.com] 
Sent: 2010年4月21日 19:27
To: gstreamer-devel at lists.sourceforge.net
Subject: [gst-devel] How can I wait for the pipeline destruction?


Depending on media, my media player destroys previously created playbin2
instance and creates and fills a new pipeline.

This new pipeline uses the previously created videosink, which also was
earlier set in the playbin2, because I want to avoid image flickering during
the pipeline recreation.

I want to be sure that the old playbin2 is destroyed before creating a new
pipeline.
How can I do that?

When I destroy the playbin2 with gst_object_unref(GST_OBJECT(m_player)), I
seem to get one more background thread, doing all this destruction stuff. 
Two threads (creation and destruction) finish nearly simultaneously, and the
destruction thread sends my videosink to the NULL state (and probably zeroes
its bus) right after my new pipeline is complete, and the function returns.

I do 
gst_object_unref(GST_OBJECT(m_player));
gst_object_unref(GST_OBJECT(m_bus));

bin=(GstElement *)gst_element_get_parent(m_videosink);
if(bin){
  rb=gst_bin_remove(GST_BIN(bin),GST_ELEMENT(m_videosink));
}
gst_object_unparent(GST_OBJECT(m_videosink));

before beginning of a new pipeline construction, but this seems to start a
new thread, as I said before, and videosink is removed too late from the
playbin2. And this pipeline sets it to the null state.

Again, how can I get sure, that playbin2 is destroyed and will not bring me
some new (street) magic?

-- 
View this message in context: http://n4.nabble.com/How-can-I-wait-for-the-pipeline-destruction-tp2018772p2018772.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list