<div dir="ltr"><div>Hi, I'm sure that the gst_buffer_new_wrapped_full() function can't free the wrapped memory.<br></div><div>If you see it have been freed maybe it's freed by another thread, probably another code in another thread unmaps it.<br></div><div>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(),</div><div>we can make a conclusion, that the management is not complete - in other words there's no logic that would free the data.<br></div><div>And if it's still freed, then there's another code that does that and does that at the wrong moment.<br></div><div><br>IMHO the mapping should be attached to the buffer through the "user_data" parameter of the gst_buffer_new_wrapped_full(),<br> and the "notify" callback should destroy this mapping, so when the refcount of the buffer</div><div>reaches 0 and the buffer (and it's GstMemory) is freed it will unmap the DMA.<br></div><div><br></div><div>Kind Regards,<br clear="all"></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span><div dir="ltr" style="margin-left:0pt" align="left"><table style="border:none;border-collapse:collapse"><colgroup><col width="220"><col width="175"></colgroup><tbody><tr style="height:50.25pt"><td style="border-left:solid #ffffff 1pt;border-right:solid #ffffff 1pt;border-bottom:solid #f915ab 1pt;border-top:solid #ffffff 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:"DM Sans",sans-serif;color:rgb(0,0,0);background-color:transparent;font-weight:700;vertical-align:baseline">Aleksandr Slobodeniuk</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:8pt;font-family:"DM Sans",sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">Senior Software Engineer</span></p></td><td style="border-left:solid #ffffff 1pt;border-right:solid #ffffff 1pt;border-bottom:solid #f915ab 1pt;border-top:solid #ffffff 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:8pt;font-family:"DM Sans",sans-serif;color:rgb(249,21,171);background-color:transparent;font-weight:700;vertical-align:baseline">+34 936 03 42 35</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:8pt;font-family:"DM Sans",sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">Carrer de Jordi Girona, 29</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:8pt;font-family:"DM Sans",sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">08034, Barcelona, Spain.</span></p></td></tr><tr style="height:0pt"><td style="border-left:solid #ffffff 1pt;border-right:solid #ffffff 1pt;border-bottom:solid #ffffff 1pt;border-top:solid #f915ab 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="http://fluendo.com" target="_blank"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline"><span style="border:none;display:inline-block;overflow:hidden;width:135px;height:23px"><img src="https://lh7-us.googleusercontent.com/7f4gLdr2vrB3tXPMwJmLsq1xFFFqPKnq7My8TnumcBKpIMI0HfrvUTStJeCYVUP7FynvoYZw1jq-6fQtHdK7u3qLC7NEmPMet6iQkYpoPcyp3EUYQBrOnhgFYa7XDzgeDkJjVBknQdmb76YE2o3c63s" width="135" height="23" style="margin-left:0px;margin-top:0px"></span></span></a></p></td><td style="border-left:solid #ffffff 1pt;border-right:solid #ffffff 1pt;border-bottom:solid #ffffff 1pt;border-top:solid #f915ab 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://es.linkedin.com/company/fluendo" target="_blank"><span style="font-size:10pt;font-family:"DM Sans",sans-serif;color:rgb(17,85,204);background-color:transparent;font-weight:700;vertical-align:baseline"><span style="border:none;display:inline-block;overflow:hidden;width:23px;height:22px"><img src="https://lh7-us.googleusercontent.com/OzDx4NDORH8FwQh0Ux7Eqszty4oDNvLyo5ad22JS7q56cErOlNi67GdfCqrm0usd5BLylF7NHaveLM3xgRy99wMKYbhF-BxnrlHeUpOzDHYrG0E70Yb78WFAZuuTG4XQAgSVBxhPIXz3WvcK2_PrW9I" width="23" height="22" style="margin-left:0px;margin-top:0px"></span></span></a><span style="font-size:10pt;font-family:"DM Sans",sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> </span><a href="https://twitter.com/fluendo" target="_blank"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline"><span style="border:none;display:inline-block;overflow:hidden;width:22px;height:22px"><img src="https://lh7-us.googleusercontent.com/dP_zElA4XMeIAQtvlavqqCuEG9zesjnBeqAMRtw-5HKzaLT5nyX49DGsOuwokHCOLVQZTvc1Ng7NPJ8ozUhweGF6BWx-33UYp5XEQSCAcefq4NfZOUGRQgRVWvv5Jyb725Rlc-zuXkM-T-MXCmqfVqo" width="22" height="22" style="margin-left:0px;margin-top:0px"></span></span></a><span style="font-size:10pt;font-family:"DM Sans",sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> </span><a href="https://github.com/fluendo" target="_blank"><span style="font-size:10pt;font-family:"DM Sans",sans-serif;color:rgb(17,85,204);background-color:transparent;font-weight:700;vertical-align:baseline"><span style="border:none;display:inline-block;overflow:hidden;width:24px;height:23px"><img src="https://lh7-us.googleusercontent.com/xe27dLIuIPtsQqcHCI4EhUQzqxQmQTe3h0rsuabYwOv8-BoHKM50vhxMKUsssJ91DmCTt_MsYCwxQmZq-8bIQY-9e3TFdbr3ckIfX3eSx1YKF5JB7LgH7v6qbjsn0ntflPyrb694cH-t9BYspEeZK-Q" width="24" height="23" style="margin-left:0px;margin-top:0px"></span></span></a><span style="font-size:10pt;font-family:"DM Sans",sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> </span></p></td></tr></tbody></table></div></span></div></div></div><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Nov 30, 2024 at 12:00 AM Gregoire Gentil via gstreamer-devel <<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I push data in an appsrc element with gst_app_src_push_buffer.<br>
<br>
Data is mmaped from a fixed DMA memory allocation.<br>
<br>
I'm currently using GstBuffer *buffer = gst_buffer_new_wrapped_full to <br>
wrap data in the gstreamer buffer that is passed.<br>
<br>
Even if the notify function is null, the framework is still trying to <br>
free my data.<br>
<br>
It's actually "working" but freeing mapped memory and continuing to use <br>
it is certainly not a good idea.<br>
<br>
I obviously don't want to memcpy data. What is the proper way to wrap <br>
data in a GstBuffer structure so that gstreamer never tries to free the <br>
memory?<br>
<br>
Thank you in advance,<br>
<br>
Grégoire<br>
<br>
</blockquote></div>