<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri, sans-serif" size="2">
<div style="text-align: justify; ">Hi,</div>
<div style="text-align: justify; ">I had a v4l2 camera driver with the &#8220;V4L2_MEMORY_USERPTR&#8221; type memory support and a camera source element &#8220;v4l2newcamsrc&#8221; to support this type memory. </div>
<div style="text-align: justify; ">When I running the pipeline bellow</div>
<div style="text-align: justify; ">&#8220;gst-launch v4l2newcamsrc num-buffers=1 ! ffmpegcolorspace ! video/x-raw-yuv,width=640,height=480 ! filesink&nbsp; location=image_640.yuv&#8221;</div>
<div style="text-align: justify; ">The image can be captured successfully. </div>
<div style="text-align: justify; ">But when the buffers are freed in the camera source element, there will always be an error message in the terminal.</div>
<div style="text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
<div style="text-align: justify; ">*** glibc detected *** /usr/local/meego/bin/gst-launch-0.10: free(): invalid pointer: 0xb73c8008 ***</div>
<div style="text-align: justify; ">======= Backtrace: =========</div>
<div style="text-align: justify; ">/lib/libc.so.6[0x550cc1]</div>
<div style="text-align: justify; ">/usr/local/meego/lib/libgstreamer-0.10.so.0(&#43;0x29c06)[0xb7792c06]</div>
<div style="text-align: justify; ">/usr/local/meego/lib/libgstreamer-0.10.so.0(gst_mini_object_unref&#43;0xaf)[0xb77b94df]</div>
<div style="text-align: justify; ">.</div>
<div style="text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
<div style="text-align: justify; ">I use gst_pad_alloc_buffer_and_set_caps() to allocate the buffer from the download element in the camera source element. </div>
<div style="text-align: justify; ">When the application exit, gst_buffer_unref (buffer) will be called to free the memory. This code case the error above after debugging with GDB.</div>
<div style="text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
<div style="text-align: justify; ">I have two questions about that.</div>
<ol style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 18pt; ">
<li>Which element is responsible for the memory allocation when call &#8220;gst_pad_alloc_buffer_and_set_caps()&#8221; in camera source element in my pipeline.</li><li>How to free the memory allocated by &#8220;gst_pad_alloc_buffer_and_set_caps()&#8221;? Why the error &#8220;free(): invalid pointer: 0xb73c8008 ***&#8221; occurred.</li></ol>
<div style="padding-left: 18pt; text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
<div style="padding-left: 18pt; text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
<div style="text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
<div style="text-align: justify; ">Thanks.</div>
<div style="text-align: justify; ">Best Regards!</div>
<div style="text-align: justify; "><font face="Jokerman, fantasy" color="#404040"><i>Hu Gang</i></font></div>
<div style="text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
<div style="text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
<div style="text-align: justify; "><font face="Times New Roman, serif">&nbsp;</font></div>
</font>
</body>
</html>