I am developing an application that needs to create and remove the pipeline repeatedly. When I do this the memory of the application grows and grows, it never decreases. Even after 10 repetitions I remove all the pipeline and call gst_deinit and it is not released. This is the code:
void GstVideo::createPipeline() m_pipeline = ("filesrc location=/media/datos/video.mp4 ! qtdemux ! avdec_h264 ! videoconvert ! video/x-raw,format=RGB ! appsink name=appsink"); if(!err) { GstElement* sink = gst_bin_get_by_name((GstBin*)m_pipeline, "appsink"); gst_app_sink_set_emit_signals(GST_APP_SINK(sink), TRUE); gst_app_sink_set_max_buffers(GST_APP_SINK(sink), 1); gst_app_sink_set_drop(GST_APP_SINK(sink), TRUE); g_signal_connect(sink, "new-sample", G_CALLBACK(GstVideo::newSample), (gpointer)this); g_signal_connect(sink, "eos", G_CALLBACK(GstVideo::eos), (gpointer)this); } else { g_error_free(err); } } GstFlowReturn GstVideo::newSample(GstAppSink *sink, gpointer user_data) { GstSample* sinkSample = gst_app_sink_pull_sample(GST_APP_SINK(sink)); if(sinkSample) { GstMapInfo info; GstBuffer* buffer = gst_sample_get_buffer(sinkSample); gst_buffer_map(buffer, &info, GST_MAP_READ); GstCaps *caps = gst_sample_get_caps(sinkSample); GstStructure * structure = gst_caps_get_structure(caps, 0); [...] gst_buffer_unmap(buffer, &info); gst_sample_unref(sinkSample); } return GST_FLOW_OK; } GstVideo::~GstVideo() { if(m_pipeline) { gst_element_set_state(m_pipeline, GST_STATE_NULL); gst_object_unref( m_pipeline); } _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
gst_bin_get_by_name() increases the refcount to your appsink. After you
set your appsink callbacks/signals you should also gst_object_unref() this object again. This increased refcount probably causes your pipeline to not be released correctly as the appsink is not released. Cheers, Florian _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by vasconce1o
You are leaking the appsink since get_by_name returns a ref. You should also check the doc for get_buffer. Le 28 juil. 2017 11:28 PM, "Yuniesky Vasconcelo" <[hidden email]> a écrit :
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Florian Zwoch
Thanks.
I did what you suggested, but the memory continues to grow. I did other tests by changing the decoder and the memory does not grow. This is the new pipeline: filesrc location=/media/datos/video.webm ! matroskademux ! vp8dec ! videoconvert ! appsink; The video have the same resolution and bitrate. The Gstreamer version is 1.2.4. Perhaps, there are some memory leaks in the avdec_h264? -- View this message in context: http://gstreamer-devel.966125.n4.nabble.com/delete-a-pipeline-the-right-way-tp4684015p4684021.html Sent from the GStreamer-devel mailing list archive at Nabble.com. _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by vasconce1o
Hi, are you forced to use this old version of Gstreamer (because embedded system where no newer version is available or proprietary elements not available/compatible with up-to-date
versions)? Or can you use one of the latest 1.10.x or 1.12.x versions to check if problem still exists? Or perhaps try the same on a PC? There is a built-in leak-checker in latest version of gstreamer. Perhaps you get new clues from it? Best regards, Martin Am 29.07.2017 um 19:56 schrieb Yuniesky
Vasconcelo:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thanks. I compiled gstreamer 1.12.2, and the memory leaks continue. There is a bug report at https://bugzilla.gnome.org/show_bug.cgi?id=783733, but I'm not answer. So, I compiled gstreamer-validate-1.12.1, it have some errors that i dont know how to fix. The error is: ERROR 12:14:26 gstvalidatetestmanager _list_testers: None not found (../../opt/gstreamer-dist-1.10.5/lib/gst-validate-launcher/python/launcher/baseclasses.py:1247) 2017-07-30 4:52 GMT-04:00 Martin Maurer <[hidden email]>:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |