[Bug 619500] It is not possible to "recycle" buffers without subclassing GstBuffer object

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Tue Feb 22 06:21:26 PST 2011


https://bugzilla.gnome.org/show_bug.cgi?id=619500
  GStreamer | gstreamer (core) | 0.10.29

--- Comment #10 from Tommi Myöhänen <tommi.myohanen at digia.com> 2011-02-22 14:21:22 UTC ---
(In reply to comment #8)
> It's quite easy to have a pool of underlying memory, as opposed to a pool of
> buffers.
> 
> Create a buffer:
> 
>   - select a free chunk from the pool, mark as non-free
>   - create an appropriate buffer for that memory
>   - set buffer->free and buffer->malloc_data
> 
> When the buffer is unreffed 1->0, buffer->free is called:
> 
>   - mark chunk as free

But the point is that my element doesn't own that underlying memory; it is
being owned and pooled by other element in downstream pipeline, for example
xvimagesink. However, my element would still like to have a pool of buffers,
which I want to allocate from that downstream element (from hardware).

> > And using subclassed GstBuffer prevents the use of gst_pad_alloc_buffer() call.
> 
> This is not correct, as xvimagesink subclasses GstBuffer and provides buffers
> to peers.

What I ment that if my own element wants to create a subclass of GstBuffer (and
create a pool of those), then it cannot allocate those subclassed buffers from
downstream without hacks.


(In reply to comment #9)
> FWIW, there is also a per-buffer freefunction.

Yes, I know. But if the one who gave me the buffer (e.g. xvimagesink) pools
those buffers, then this freefunction isn't called, since the buffer isn't
physically freed (buffer is just put back to pool).

So, ultimately what I'd like to achieve:

1) My (source) element wants to pre-allocate a pool of buffers from downstream
2) The element wants to know when the pushed buffer has been rendered, so that
it can revive it back to the pool

To solve (1), the element must use gst_pad_alloc_buffer().
To solve (2), the element must get a signal that buffer has been freed (by the
sink). But this is currently impossible.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list