trying to unref buffer in appsink

killerrats koreysjunkmail at gmail.com
Tue Jan 17 18:27:59 UTC 2017


No matter what order I put the unref buffer and sample the last one seems to
error out. Any ideas?
I tried exactly what the function looks like nothing assign at all to see if
there something else that messed it up but no avail. it seems to be the
gst_buffer_unref(buffer) but if I dont gst_buffer_unref then the method is
okay with everything.

GstFlowReturn PipelineClass::appsink_ToFile (GstElement* object,gpointer
user_data)
{
	GstSample* sample = NULL;	
	GstBuffer* buffer;
	GstMapInfo map;
	GstFlowReturn flow;
	std::string TheFile = "";

	flow = GST_FLOW_OK;
	//g_signal_emit_by_name(object,"pull-sample",&sample);
	sample = gst_app_sink_pull_sample ((GstAppSink*)object);
	if(sample != NULL)
	{
		buffer = gst_sample_get_buffer(sample);

		if(gst_buffer_map (buffer, &map, GST_MAP_READ))
		{
			......
		
		}
	}
	else
	{
		AddToConsoleOutputList("no sample");
	}
	if(map.data != NULL)
	{
		AddToConsoleOutputList("unmap map to buffer");
		gst_buffer_unmap (buffer, &map);
	}
	if(buffer != NULL)
	{
		AddToConsoleOutputList("Buffer Unref");
		gst_buffer_unref(buffer);
	}
	if(sample != NULL)
	{
		AddToConsoleOutputList("sample Unref");
		gst_sample_unref(sample);
	}
	
	if(gst_app_sink_is_eos ((GstAppSink*)object))
	{
		AddToConsoleOutputList("------------- EOS Recieved --------------");
		return GST_FLOW_EOS;
	}

	return flow;    
}



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/trying-to-unref-buffer-in-appsink-tp4681495.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list