appsink new-sample

killerrats koreysjunkmail at gmail.com
Wed Nov 29 22:35:32 UTC 2017


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/


More information about the gstreamer-devel mailing list