appsrc and GMainloop problem

Tim-Philipp Müller t.i.m at zen.co.uk
Mon Sep 2 04:12:01 PDT 2013


On Sat, 2013-08-31 at 11:56 +0530, Deepak Jain wrote:

Hi,

> Now, there is another issue:
> 
> 
> See, I get the elementary video buffers in a thread, which I am
> pushing in appsrc and the rest of pipeline is:
> 
> 
> appsrc->h264parse->ffdec_h264->ffmpegcolorspace->videoscale->autovideosink
> 
> 
> I am using Gstreamer 0.10
> 
> 
> 
> I am pushing buffers like:
> 
>             GstBuffer* buf = gst_buffer_new_and_alloc(datalen);
>             memcpy(GST_BUFFER_DATA(buf), data, datalen);
>             GST_BUFFER_TIMESTAMP(buf) = (pts) * 1000000; (in nanosec)
>             gst_app_src_push_buffer(mPlaybackGroup->appsrc, buf);
> 
> 
> 
> 
> Now, if I delete the buf after pushing it in appsrc, my video is
> garbled. And if I don’t, then it plays perfectly.
> 
> So, I am not able to understand when I need to delete the buf, which I
> am creating OR appsrc will automatically take care of it?

gst_app_src_push_buffer() "takes ownership" of the buffer. This means
that you gave ownership of the buffer you created away to GstAppSrc, and
it will free it when it doesn't need it any longer.

You must not access or use the buffer after passing ownership to
GstAppSrc (it might already have been freed by the time _push_buffer()
returns).

The API reference will tell you whether a function takes ownership or
not.

 Cheers
  -Tim




More information about the gstreamer-devel mailing list