This post was updated on .
Hi everyone,
I'm creating a new buffer in my gstreamer's plugins and then I don't touch that buffer. However, data of old buffer appears in new one. How does old buffer appear in new one? Here my C code: static GstFlowReturn gst_coder_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { Gstcoder *filter; filter = GST_CODER (parent); g_print ("%d x %d\n",filter->width,filter->height); g_print ("Have data of size %" G_GSIZE_FORMAT" bytes!\n", gst_buffer_get_size (buf)); gint sz = 0; if ((sz = gst_buffer_get_size(buf)) != 0) { * //info stores properties about buffer* GstMapInfo info; gst_buffer_map (buf, &info, GST_MAP_WRITE); *//create template var buffer* GstBuffer *buffer = gst_buffer_new_allocate(NULL, sz, NULL); GstMapInfo info1; gst_buffer_map (buffer, &info1, GST_MAP_WRITE); gst_buffer_unmap (buf, &info); gst_buffer_unref (buf); gst_buffer_unmap (buffer, &info1); return gst_pad_push (filter->srcpad, buffer); } GST_WARNING ("zero sized buffer"); return gst_pad_push (filter->srcpad, buf); } I'd appreciate any advice. Thanks gstcoder.c gstcoder.h -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list gstreamer-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
On Fri, Sep 29, 2017 at 9:52 PM, Ozhmegov <[hidden email]> wrote: > I'm creating a new buffer in my gstreamer's plugins and then I don't > touch that buffer. However, data of old buffer appears in new one. How does > old buffer appear in new one? I'm not quite sure what you mean. What appears where? Do you have a complete minimal example which we can compile and try? > GstBuffer *buffer = gst_buffer_new_allocate(NULL, sz, NULL); If you mean by the buffer has old contents right after the allocation, that's how heap memory (g_slice_alloc / malloc) works in C. https://stackoverflow.com/a/8029624/640650 -- yashi _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Ozhmegov
Le vendredi 29 septembre 2017 à 05:52 -0700, Ozhmegov a écrit :
> I'm creating a new buffer in my gstreamer's plugins and then I don't > touch that buffer. However, data of old buffer appears in new one. How does > old buffer appear in new one? > Here my C code: For performance reason, a heap being asked for a buffer with the size of a previously released buffer, will likely return you the same buffer. Also, for performance reason, we don't clear the buffers. You application will need to handle that if it wanted an zero-ed out buffer. Nicolas _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (201 bytes) Download Attachment |
Hi,
Thank you for replies I posted my coder.c and coder.h files (see above). I understood my mistakes. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |