GstBuffer send via g_signal_emit_by_name()

Martin Vachovski Martin.Vachovski at skytek.com
Wed Oct 24 15:08:34 UTC 2018


Hi all,


I have a rather general question about the refcounting within the

g_signal_emit_by_name()

API.


I was examining some older gstreamer code of mine and found the following use



  GstBuffer *gst_buff = gst_buffer_new_allocate(...);

  // prepare a video/x-raw GstBuffer

  g_signal_emit_by_name(VideoCamPipelineGst.src, "push-buffer", gst_buff, &ret);
  gst_buffer_unref(gst_buffer); // UNREF

}


To clarify, the VideoCamPipelineGst.src pointer is a pointer to a *appsrc* element.

Now, the demonstrated code works (I've never seen it crash), but I have doubts as if it is stable or it might cause some unexpected seg fault.
The problem I see is that right after I "emit" the "push-buffer" signal I unref the gst_buff (on the line with UNREF comment)
which should be its only reference, unless the gst_buff's refcount is incremented within the g_signal_emit_by_name?.

The question is: is the above idiomatic use legit (i.e. is the g_signal_emit_by_name increases the refcount of the buffer)
or the above construction is illegal and I must switch to using
gst_app_src_push_buffer()
instead?

Many thanks
Martin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20181024/83fbc9a2/attachment.html>


More information about the gstreamer-devel mailing list