Administrator
|
in this method you get the sample,buffer and map data. I have a memory leak i
believe. I feel like it might be the buffer in this method. If I go to use gst_buffer_unref or gst_object_unref it will say "failed to refcount to 0" or "GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed". I just wondered if maybe it's fine the way it is, or I should change the way I unref sample,mapdata,buffer. GstFlowReturn appsink_ToFile (GstElement* object,gpointer pipelineclass) { PipelineClass* pipe = (PipelineClass*)pipelineclass; GstFlowReturn flow = GST_FLOW_OK; GstSample* _app_sample; GstMapInfo _app_map; GstBuffer* _app_buffer; g_signal_emit_by_name(object,"pull-sample",&_app_sample); if(_app_sample != NULL) { _app_buffer = gst_sample_get_buffer(_app_sample); if(gst_buffer_map (_app_buffer, &_app_map, GST_MAP_READ)) { /// code } if(_app_map.data != NULL) { gst_buffer_unmap (_app_buffer, &_app_map); } if(_app_sample != NULL) { gst_sample_unref(_app_sample); } } else { pipe->AddToConsoleOutputList("no sample"); } return flow; } -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.16.2 ------------------------------ Windows |
Administrator
|
if you reference an object in the main object in different methods create a
memory leak? This isn't how I do the pipeline but just an example. Just wondering if going too fast before it has a chance to unreference an object? for example: GstElement* pipeline; GstElement* source,* parse; int main() { do { link(); release(); unlink(); }while(true); return 0; } GstElement getElement(GstElement* element,std::string name) { return gst_bin_get_by_name (GST_BIN(element), name.c_str()); } void link() { gst_bin_add_many(GST_BIN(pipeline),source,parse,NULL); } void release() { GstElement* source,* parse; source = getElement(pipeline,"source"); parse = getElement(pipeline,"source"); if(source != NULL) gst_object_unref(source); if(parse != NULL) gst_object_unref(parse); } void unlink() { GstElement* source,* parse; source = getElement(pipeline,"source"); parse = getElement(pipeline,"source"); if(source != NULL) gst_object_unref(source); if(parse != NULL) gst_object_unref(parse); } -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.16.2 ------------------------------ Windows |
Administrator
|
In reply to this post by killerrats
when I added the gst_buffer_unref it keeps it down a little but sample unref
will fail. saying: GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed sometimes it will unref sometimes it won't unref. any ideas? GstFlowReturn appsink_ToFile (GstElement* object,gpointer data) { GstFlowReturn flow = GST_FLOW_OK; GstSample* _app_sample; g_signal_emit_by_name(object,"pull-sample",&_app_sample); if(_app_sample != NULL) { GstMapInfo _app_map; GstBuffer* _app_buffer; _app_buffer = gst_sample_get_buffer(_app_sample); if(gst_buffer_map (_app_buffer, &_app_map, GST_MAP_READ)) { /// code } if(_app_map.size > 0) { gst_buffer_unmap (_app_buffer, &_app_map); } if (gst_buffer_get_size(_app_buffer) > 0) { gst_buffer_unref(_app_buffer); } if(_app_sample != NULL) { gst_sample_unref(_app_sample); } } else { pipe->AddToConsoleOutputList("no sample"); } return flow; } -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.16.2 ------------------------------ Windows |
Le jeudi 07 décembre 2017 à 16:34 -0700, killerrats a écrit :
> when I added the gst_buffer_unref it keeps it down a little but > sample unref > will fail. saying: > GStreamer-CRITICAL **: gst_mini_object_unref: assertion > 'mini_object->refcount > 0' failed No, the buffer is unrefed when you unref the sample. What you forgot is to unmap the buffer, see gst_buffer_unmap(). Not unmapping a buffer (or a memory) will leak that object. Nicolas _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |