Pool of variable-size buffers

Petr Kulhavy brain at jikos.cz
Tue Dec 6 17:36:30 UTC 2016


Hi Olivier,

thank you for the detailed explanation. Doing this without a single 
allocation is exactly what I'm looking for.
I have a few more questions:

* Can I integrate the pool creation into the caps negotiation, i.e. 
_decide_allocation() and possibly reuse a pool provided by a downstream 
element ?

* Can I just pass 0 as size to gst_buffer_pool_config_set_params() and 
gst_query_add_allocation_pool() even though the doc says size must be >0 
? ;-)

* How can I pre-allocate the GstMemory objects prior to knowing the 
memory location and size? I don't see a function to replace or 
manipulate the GstMapInfo within GstMemory.


Thanks
Petr

On 06/12/16 00:39, Olivier CrĂȘte wrote:
> Hi,
>
> Using a GstBufferPool is a valid option. One thing you can do is to
> create entirely empty buffers (with no memories attached). You will
> then need to implement a custom reset_memory vfunc on the bufferpool
> to reset the memory tag flag and separate the memories from the buffer
> before calling up. Then you can create a custom GstAllocator that you
> can use to get the GstMemory objects from, you can also pre-allocate
> those (one for each of your buffers), then you can attach them to the
> GstBuffer from the pool when you want to send something down the
> pipeline. So your entire use-case can be done without doing a single
> allocation!
>
> Olivier
>
>
> On Mon, 2016-12-05 at 20:00 +0100, Petr Kulhavy wrote:
>> Hi,
>>
>> I'm trying to implement an efficient buffer management for zero-copy
>> UDP
>> reception, where the data is provided in chunks of memory
>> preallocated
>> by the kernel.
>> The unfortunate heavy-weight nature of GStreamer buffers, where
>> every
>> buffer is a set of objects, is a bit clashing with the "efficient"
>> part
>> of my task.
>>
>> So I have the buffers of memory with data and now need to implement
>> a
>> pool of GstBuffer and GstMemory objects in order to be able to hand
>> over
>> the data down the pipeline. Kind of pool of empty buffers, where I
>> can
>> then hang whatever chunk of memory I need.
>> The buffer pool abstraction is based on the fact that all buffers are
>> of
>> equal size. This is unfortunately not what I can guarantee.
>>
>> Is there some existing abstraction I can use?
>>
>> Thanks
>> Petr
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list