gst_buffer_unref fails on appsink callback for local variables

ign bra enternald at
Mon Dec 1 06:29:02 PST 2014

Hello folks, I am playing with appsink and try to get buffer from appsink. 
This part OK.
Problem is when I do cleaning. GstBuffer fails to unref after pull:

static GstFlowReturn gstre_pull_sample_cb(GstElement* gstappsink,
                                          gpointer data){
    GstSample* sample;
    GstBuffer* buffer;
    GstCaps* caps;
    g_signal_emit_by_name (gstappsink, "pull-sample", &sample);
    if (sample) {
      buffer = gst_sample_get_buffer(sample);
      caps = gst_sample_get_caps(sample);
      g_print ("*");

    return GST_FLOW_OK;

I think I am missing something trivial about memory managment, because unref
call simply fails for buffer push:

** (GstReencoderTest:1624): CRITICAL **: gst_video_frame_map_id: assertion
'GST_IS_BUFFER (buffer)' failed

(GstReencoderTest:1624): GStreamer-CRITICAL **: gst_pad_push: assertion
'GST_IS_BUFFER (buffer)' failed

(GstReencoderTest:1624): GStreamer-CRITICAL **: gst_mini_object_unref:
assertion 'mini_object->refcount > 0' failed

How to properly release buffer in callback, I seem to fail and overunref it,
I don't know how.

View this message in context:
Sent from the GStreamer-devel mailing list archive at

More information about the gstreamer-devel mailing list