<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 “V4L2_MEMORY_USERPTR” type memory support and a camera source element “v4l2newcamsrc” to support this type memory. </div>
<div style="text-align: justify; ">When I running the pipeline bellow</div>
<div style="text-align: justify; ">“gst-launch v4l2newcamsrc num-buffers=1 ! ffmpegcolorspace ! video/x-raw-yuv,width=640,height=480 ! filesink location=image_640.yuv”</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"> </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(+0x29c06)[0xb7792c06]</div>
<div style="text-align: justify; ">/usr/local/meego/lib/libgstreamer-0.10.so.0(gst_mini_object_unref+0xaf)[0xb77b94df]</div>
<div style="text-align: justify; ">.</div>
<div style="text-align: justify; "><font face="Times New Roman, serif"> </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"> </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 “gst_pad_alloc_buffer_and_set_caps()” in camera source element in my pipeline.</li><li>How to free the memory allocated by “gst_pad_alloc_buffer_and_set_caps()”? Why the error “free(): invalid pointer: 0xb73c8008 ***” occurred.</li></ol>
<div style="padding-left: 18pt; text-align: justify; "><font face="Times New Roman, serif"> </font></div>
<div style="padding-left: 18pt; text-align: justify; "><font face="Times New Roman, serif"> </font></div>
<div style="text-align: justify; "><font face="Times New Roman, serif"> </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"> </font></div>
<div style="text-align: justify; "><font face="Times New Roman, serif"> </font></div>
<div style="text-align: justify; "><font face="Times New Roman, serif"> </font></div>
</font>
</body>
</html>