[gst-devel] Memory leak for dynamic pipeline using decodebin

Jens Schmutzler schmutzler at gmx.net
Fri Jun 30 13:23:00 CEST 2006


I am quite new to GStreamer and I've got one question.

I want to build a dynamic pipeline with "decodebin". Depending on the "new-decoded-pad" signal I extend my pipeline with the corresponding audio or video or audio+video part. I implemented the "new-decoded-pad" callback function and the initial pipeline setup succeeds for several media files. :-)

The problem I am running into right now, is a considerable memory leak which occurs when changing the state of the pipeline from "anything higher than READY" to "READY or lower" and then back to "anything higher than READY" again... e.g.: 
- Stopping a video: "PLAYING -> READY -> PLAYING" 
- Loading a new file "PAUSED -> NULL -> PAUSED" 

Obviously something is not deallocated properly... But the only thing which is executed when moving from "PLAYING -> READY -> PLAYING" is the CB function.

The App-Dev Documentation says the following about the READY state: 
"If a stream was previously opened, it should be closed in this state, and position, properties and such should be reset." 

To be honest this is not much help for me, because I thought that changing the state of the pipeline entirely(!) controls the stream... Applications which use "playbin" (e.g. kiss) just set the state and do nothing else. So how to (and why) explicitly CLOSE a stream and what else do I need to take care of in order to get rid of memory leaks for the described state transition (unreffing anything from the pipeline)?! 

Thanks a lot in advance for helping me out!



Here is (simplified) what I do in the CB function:

void MediaPlugin::cb_newpad (GstElement *dec, GstPad *dec_pad, gboolean last, gpointer data)
	// to get access to stuff contained in the object which called the CB_Function do:
	MediaPlugin *m_plugin = static_cast <MediaPlugin*> ( data );	
	GstPad *VideoConverter_SinkPad = NULL;
	VideoConverter_SinkPad = gst_element_get_pad (m_plugin->Video_Converter, "sink");
	if (gst_pad_link (dec_pad, VideoConverter_SinkPad) == GST_PAD_LINK_OK)
	gst_object_unref (VideoConverter_SinkPad);

More information about the gstreamer-devel mailing list