gst_buffer_resize_range bug ?

Gregor Boirie gregor.boirie at parrot.com
Mon Mar 16 05:43:15 PDT 2015


On Mon, Mar 16, 2015 at 10:04:27AM +0000, Nicolas Dufresne wrote:
> 
> 
> Le 03/16/2015 09:04 AM, Gregor Boirie a écrit :
> > I'm trying to use gst_buffer_resize_range to reuse space located ahead of a
> > GstBuffer, i.e. with a negative offset passed as 4th argument (and negative
> > size as required).
> 
> I doubt offset can be negative. If you want to add a header, create a
Well, I naïvely supposed it was possible since offset is a gssize.
Moreover, the following check leads me to assume it might be possible:

from 1.4.5, gstreamer/gst/gstbuffer.c:1412:
*****
g_return_val_if_fail ((offset < 0 && bufoffs >= -offset) || (offset >= 0
          && bufoffs + offset <= bufmax), FALSE);
*****

> GstMemory (you can uses the default allocator), and do
> gst_buffer_prepend_memory(). Make sure the buffer is writable of course.
That was the solution I thought of at first glance.
However I need to write 2 bytes only and I'm sure space is available (in my
case): prepending an additional GstMemory seems overkill to me.

I need this to encapsulate an H.264 payload into RTP buffer. It seems
gstrtpbuffer logic makes assumptions about buffer's GstMemory layout and I don't
fully understand theses.
This is why I'd rather prefer not to mess with GstMemory instances here.

Many thanx.

> 
> Nicolas
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-- 
Gregor


More information about the gstreamer-devel mailing list