problem with buffer not getting freed

Tim Müller tim at centricular.com
Thu Sep 10 01:21:47 PDT 2015


On Wed, 2015-09-09 at 20:32 +0000, Iván Aponte wrote:

Hi,

>  I have this problem. When I create a buffer with
> gst_buffer_new_wrapped and send it with gst_app_src_push_buffer, if
> the pipeline have a tee with two or more elements. Buffer does not get
> destroyed and rapidly fills the memory. 

That's because the pipeline never actually goes into PLAYING state, it
never prerolls, so you keep pushing buffers into appsrc but they are not
consumed.

The reason the pipeline never prerolls is that your pipeline looks like
this:

appsrc -> q1 -> tee --> q2
                  \---> q3 --> fakesink2

  videoconvert --> capsfilter --> fakesink

That last branch is unconnected, so that fakesink will never receive any
buffers, so the pipeline will never preroll.

Your link_many(appsrc,q1,tee,q2,vc,NULL) call fails, because q2 got
already linked to tee in q2=get_q_from_t(tee,"q2");

This makes it work:

  q2=get_q_from_t(tee,"q2");
  q3=get_q_from_t(tee,"q3");
  if (!gst_element_link_many(appsrc,q1,tee,NULL))
    g_error ("link many appsrc-q1-tee failed");
  if (!gst_element_link_many(q2,vc,NULL))
    g_error ("link many q2-vc failed");
  if (!gst_element_link_filtered(vc,sink,cap))
    g_error ("failed to link vc + sink with caps");
  gst_element_link(q3,fs);

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference: 8-9 October 2015 in Dublin, Ireland




More information about the gstreamer-devel mailing list