How to push data in appsrc without freeing memory?
Aleksandr Slobodeniuk
aslobodeniuk at fluendo.com
Sat Nov 30 01:36:11 UTC 2024
Hi, I'm sure that the gst_buffer_new_wrapped_full() function can't free the
wrapped memory.
If you see it have been freed maybe it's freed by another thread, probably
another code in another thread unmaps it.
Since you don't want your data to be freed while it's used, but also are
passing NULL to the gst_buffer_new_wrapped_full(),
we can make a conclusion, that the management is not complete - in other
words there's no logic that would free the data.
And if it's still freed, then there's another code that does that and does
that at the wrong moment.
IMHO the mapping should be attached to the buffer through the "user_data"
parameter of the gst_buffer_new_wrapped_full(),
and the "notify" callback should destroy this mapping, so when the refcount
of the buffer
reaches 0 and the buffer (and it's GstMemory) is freed it will unmap the
DMA.
Kind Regards,
Aleksandr Slobodeniuk
Senior Software Engineer
+34 936 03 42 35
Carrer de Jordi Girona, 29
08034, Barcelona, Spain.
<http://fluendo.com>
<https://es.linkedin.com/company/fluendo> <https://twitter.com/fluendo>
<https://github.com/fluendo>
On Sat, Nov 30, 2024 at 12:00 AM Gregoire Gentil via gstreamer-devel <
gstreamer-devel at lists.freedesktop.org> wrote:
> I push data in an appsrc element with gst_app_src_push_buffer.
>
> Data is mmaped from a fixed DMA memory allocation.
>
> I'm currently using GstBuffer *buffer = gst_buffer_new_wrapped_full to
> wrap data in the gstreamer buffer that is passed.
>
> Even if the notify function is null, the framework is still trying to
> free my data.
>
> It's actually "working" but freeing mapped memory and continuing to use
> it is certainly not a good idea.
>
> I obviously don't want to memcpy data. What is the proper way to wrap
> data in a GstBuffer structure so that gstreamer never tries to free the
> memory?
>
> Thank you in advance,
>
> Grégoire
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20241130/0e49069d/attachment.htm>
More information about the gstreamer-devel
mailing list