<div dir="ltr">Hi Peter,<div><br></div><div>Yes, I made an array of garbage so that GstBuffer would not complain...v4l2src places a v4l2_buffer in the GstBuffer meta data as well as a pointer to the real memory that contains the JPEG data. When the GstBuffer gets to the uvch264src plugin, I modified the source to retrieve a pointer to the real memory containing the JPEG data from the GstBuffer meta data.</div>
<div><br></div><div>The difference between what is done in regards to v4l2src versus other plugins that I know of is that buffers are allocated via the UVC video driver from kernel space, mapped to user space and wrapped in a GstBuffer.</div>
<div><br></div><div>Best Regards,</div><div><br></div><div>Rob</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 9, 2013 at 3:34 PM, Peter Rennert <span dir="ltr"><<a href="mailto:p.rennert@cs.ucl.ac.uk" target="_blank">p.rennert@cs.ucl.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi Rob,<br>
<br>
I think GstBuffers and GstMemory goes far beyond my knowledge
about gstreamer. But if it would be a general error related to
GstBuffer and GstMemory, would that not lead to other applications
fail as well after some time?<br>
<br>
But what you were saying is that you can insert as often as you
want "fake" (but still valid) JPEG data into v4l2src and it will
not crash? I did not even try yet to capture from the cam with
v4l2. Did you try that?<br>
<br>
I was also thinking to try to stream a video with v4l2sink and
capture it using uvch264src (not sure if they are compatitble). Do
you think that should crash as well? I am sorry its getting late
here. I will try and do some experiments tomorrow on that.<div><div class="h5"><br>
<br>
<br>
<br>
On 08/09/2013 08:03 PM, Robert Krakora wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">Hi Peter,
<div><br>
</div>
<div>I further modified v4l2src to pass a static dummy array
(instead of the real memory) wrapped in the GstBuffer with a
pointer to the real memory (as usual) in the meta data of the
GstBuffer. When the GstBuffer arrived at uvch264src I pluck
the real pointer out of the meta data in the chain function
and the JPEG parsing is not failing. I really, really think
that there is an issue with GstBuffer and/or GstMemory
corrupting memory.</div>
<div><br>
</div>
<div>Best Regards,</div>
<div><br>
</div>
<div>Rob</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Fri, Aug 9, 2013 at 9:15 AM, Robert
Krakora <span dir="ltr"><<a href="mailto:rob.krakora@messagenetsystems.com" target="_blank">rob.krakora@messagenetsystems.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Peter,
<div><br>
</div>
<div>I placed the JPEG parse code in the UVC driver,
v4l2src and uvch264src plugins. The JPEG parse code did
not fail in the UVC driver but it did in the v4l2src and
uvch264src plugins. In the v4l2src plugin I noticed
that a pointer to the memory mapped form kernel space
was not only wrapped in a GstBuffer but also placed in
it's meta data. I then used the pointer that was placed
in the meta data as the pointer acted on by the JPEG
parse code and then the JPEG parse code in the v4l2src
plugin no longer failed (i.e. I removed the
gst_buffer_map() and gst_buffer_unmap() calls from
around the JPEG parse code in v4l2src and just used the
pointer from the meta data of the GstBuffer). I am
thinking that there is a bug or bugs in the GstMemory
class where memory is being merged, moved and replaced
that results in memory corruption. I compared UVC
driver logs from the JPEG parse code and uvch264src
plugin logs from the JPEG parse code and everything
jives segment size wise in regard to the first segment
encountered in the buffer until the failure where the
sizes of the first segments in both logs do not match
each other.</div>
<div><br>
</div>
<div>Best Regards,</div>
<div><br>
</div>
<div>Rob</div>
<div><br>
</div>
</div>
<div class="gmail_extra">
<div>
<div><br>
<br>
<div class="gmail_quote">On Fri, Aug 9, 2013 at 7:45
AM, Peter Rennert <span dir="ltr"><<a href="mailto:p.rennert@cs.ucl.ac.uk" target="_blank">p.rennert@cs.ucl.ac.uk</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
Rob,<br>
<br>
Is there a way for you to print both buffers
(uvch264src and UVC Driver) out and compare them?<br>
<br>
Maybe the v4l2src inserts some kind of metadata in
the buffer at some time stamps. Or maybe just
modifies somehow the two bytes after the first
0xff 0xe4.<br>
<br>
If that is the case then this line
(gst_uvc_h264_mjpg_demux_chain: 498):<br>
<br>
segment_size = GUINT16_FROM_BE (*((guint16
*) (info.data + i + 2)));<br>
<br>
<br>
will set the segment_size wrong.<br>
<br>
However, I compared your first segment size with
the one I've got earlier (email from the 25/07).
They are different. So whatever those bytes are
they are not static. It just pops into my mind
that perhaps the v4l2 swallows first bytes of the
stream. In this case the 0xff 0xe4 that the
uvch264src detects are actually image data rather
than part of the metadata.<br>
<br>
What puzzles me as well is that the first segment
size is parsed wrong and still it fails at the
last segment. Which is weird. I would expect that
if it gets a too large first segment it will
parse/copy too much of the buffer as the first
segment. The result should be that it would not be
able to find (i.e. skip) the second APP4 marker,
including its segment size tag and continue with
the third one. This is because i in the loop is
incremented with the segment_size to avoid looping
through the entire buffer in order to find the
APP4 markers (line 648).<span><font color="#888888"><br>
<br>
Peter</font></span>
<div>
<div><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
</div>
</div>
<div>-- <br>
<div dir="ltr">
<table cellpadding="2" cellspacing="0" width="426">
<colgroup><col width="422"></colgroup><tbody>
<tr>
<td style="border:none;padding:0in" valign="TOP" width="422">
<p><font face="Arial, sans-serif"><font size="4">Rob Krakora</font><font size="4">,</font><br>
Senior Software Engineer</font></p>
<p><font face="Arial, sans-serif">MessageNet
Systems<br>
101 E Carmel Dr, Suite 105<br>
Carmel, IN 46032</font></p>
<p><a href="http://www.messagenetcommunicationsystems.com/?utm_source=email+signature&utm_medium=email&utm_campaign=email+signature+to+homepage" style="color:rgb(17,85,204)" target="_blank"><font color="#1155cc"><font face="Arial, sans-serif">MessageNetSystems.com</font></font></a><font face="Arial, sans-serif"><br>
</font><a href="mailto:rob.krakora@messagenetsystems.com" style="color:rgb(17,85,204)" target="_blank"><font color="#1155cc"><font face="Arial, sans-serif">Rob.Krakora@MessageNetSystems.com</font></font></a><font face="Arial, sans-serif"><br>
P: </font><a style="color:rgb(17,85,204)"><font color="#1155cc"><font face="Arial,
sans-serif">317.566.1677</font></font></a><font face="Arial, sans-serif">, 21</font><font face="Arial, sans-serif">2</font><font face="Arial, sans-serif"><br>
F: </font><a style="color:rgb(17,85,204)"><font color="#1155cc"><font face="Arial,
sans-serif">317.663.0808</font></font></a></p>
</td>
</tr>
<tr>
<td style="border-top-width:1px;border-style:solid none none;border-top-color:rgb(0,0,0);padding:0.02in 0in 0in" valign="TOP" width="422">
<p><font face="Arial, sans-serif"><font style="font-size:8pt">For the latest
news, information, and blogs, please be
sure to visit, follow, and like us...</font></font></p>
<p><font color="#1155cc"><a href="http://www.messagenetcommunicationsystems.com/get-the-message-out-blog/?utm_source=email+signature&utm_medium=email&utm_campaign=gmail+signature+to+blog" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_1406337e8f518bd3_SafeHtmlFilter_14040bc6244eae96_graphics46" align="BOTTOM" border="0" height="34" width="34"></a> <a href="http://www.youtube.com/user/MessageNetConnection/feed" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_1406337e8f518bd3_SafeHtmlFilter_14040bc6244eae96_graphics47" align="BOTTOM" border="0" height="34" width="34"></a> <a href="http://www.linkedin.com/company/messagenet-systems" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_1406337e8f518bd3_SafeHtmlFilter_14040bc6244eae96_graphics48" align="BOTTOM" border="0" height="34" width="34"></a> <a href="http://twitter.com/MessageNet" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_1406337e8f518bd3_SafeHtmlFilter_14040bc6244eae96_graphics49" align="BOTTOM" border="0" height="34" width="34"></a> <a href="http://www.facebook.com/MessageNetsystems" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_1406337e8f518bd3_SafeHtmlFilter_14040bc6244eae96_graphics50" align="BOTTOM" border="0" height="34" width="34"></a></font></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<table cellpadding="2" cellspacing="0" width="426">
<colgroup><col width="422"></colgroup><tbody>
<tr>
<td style="border:none;padding:0in" valign="TOP" width="422">
<p><font face="Arial, sans-serif"><font size="4">Rob
Krakora</font><font size="4">,</font><br>
Senior Software Engineer</font></p>
<p><font face="Arial, sans-serif">MessageNet Systems<br>
101 E Carmel Dr, Suite 105<br>
Carmel, IN 46032</font></p>
<p><a href="http://www.messagenetcommunicationsystems.com/?utm_source=email+signature&utm_medium=email&utm_campaign=email+signature+to+homepage" style="color:rgb(17,85,204)" target="_blank"><font color="#1155cc"><font face="Arial, sans-serif">MessageNetSystems.com</font></font></a><font face="Arial, sans-serif"><br>
</font><a href="mailto:rob.krakora@messagenetsystems.com" style="color:rgb(17,85,204)" target="_blank"><font color="#1155cc"><font face="Arial, sans-serif">Rob.Krakora@MessageNetSystems.com</font></font></a><font face="Arial, sans-serif"><br>
P: </font><a style="color:rgb(17,85,204)"><font color="#1155cc"><font face="Arial, sans-serif">317.566.1677</font></font></a><font face="Arial, sans-serif">, 21</font><font face="Arial, sans-serif">2</font><font face="Arial, sans-serif"><br>
F: </font><a style="color:rgb(17,85,204)"><font color="#1155cc"><font face="Arial, sans-serif">317.663.0808</font></font></a></p>
</td>
</tr>
<tr>
<td style="border-top-width:1px;border-style:solid none none;border-top-color:rgb(0,0,0);padding:0.02in 0in 0in" valign="TOP" width="422">
<p><font face="Arial, sans-serif"><font style="font-size:8pt">For the latest news,
information, and blogs, please be sure to visit,
follow, and like us...</font></font></p>
<p><font color="#1155cc"><a href="http://www.messagenetcommunicationsystems.com/get-the-message-out-blog/?utm_source=email+signature&utm_medium=email&utm_campaign=gmail+signature+to+blog" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_SafeHtmlFilter_14040bc6244eae96_graphics46" align="BOTTOM" border="0" height="34" width="34"></a> <a href="http://www.youtube.com/user/MessageNetConnection/feed" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_SafeHtmlFilter_14040bc6244eae96_graphics47" align="BOTTOM" border="0" height="34" width="34"></a> <a href="http://www.linkedin.com/company/messagenet-systems" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_SafeHtmlFilter_14040bc6244eae96_graphics48" align="BOTTOM" border="0" height="34" width="34"></a> <a href="http://twitter.com/MessageNet" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_SafeHtmlFilter_14040bc6244eae96_graphics49" align="BOTTOM" border="0" height="34" width="34"></a> <a href="http://www.facebook.com/MessageNetsystems" style="color:rgb(17,85,204)" target="_blank"><img name="1406492e9177925d_SafeHtmlFilter_14040bc6244eae96_graphics50" align="BOTTOM" border="0" height="34" width="34"></a></font></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
gstreamer-devel mailing list
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table width="426" cellpadding="2" cellspacing="0"><colgroup><col width="422"></colgroup><tbody><tr><td width="422" valign="TOP" style="border:none;padding:0in">
<p><font face="Arial, sans-serif"><font size="4">Rob Krakora</font><font size="4">,</font><br>Senior Software Engineer</font></p><p><font face="Arial, sans-serif">MessageNet Systems<br>101 E Carmel Dr, Suite 105<br>Carmel, IN 46032</font></p>
<p><a href="http://www.messagenetcommunicationsystems.com/?utm_source=email+signature&utm_medium=email&utm_campaign=email+signature+to+homepage" style="color:rgb(17,85,204)" target="_blank"><font color="#1155cc"><font face="Arial, sans-serif">MessageNetSystems.com</font></font></a><font face="Arial, sans-serif"><br>
</font><a href="mailto:rob.krakora@messagenetsystems.com" style="color:rgb(17,85,204)" target="_blank"><font color="#1155cc"><font face="Arial, sans-serif">Rob.Krakora@MessageNetSystems.com</font></font></a><font face="Arial, sans-serif"><br>
P: </font><a style="color:rgb(17,85,204)"><font color="#1155cc"><font face="Arial, sans-serif">317.566.1677</font></font></a><font face="Arial, sans-serif">, 21</font><font face="Arial, sans-serif">2</font><font face="Arial, sans-serif"><br>
F: </font><a style="color:rgb(17,85,204)"><font color="#1155cc"><font face="Arial, sans-serif">317.663.0808</font></font></a></p></td></tr><tr><td width="422" valign="TOP" style="border-top-width:1px;border-style:solid none none;border-top-color:rgb(0,0,0);padding:0.02in 0in 0in">
<p><font face="Arial, sans-serif"><font style="font-size:8pt">For the latest news, information, and blogs, please be sure to visit, follow, and like us...</font></font></p><p><font color="#1155cc"><a href="http://www.messagenetcommunicationsystems.com/get-the-message-out-blog/?utm_source=email+signature&utm_medium=email&utm_campaign=gmail+signature+to+blog" style="color:rgb(17,85,204)" target="_blank"><img src="http://www.messagenetcommunicationsystems.com/wp-content/uploads/2013/07/MessageNet_Logo_200x200-e1374867138718.jpg" name="SafeHtmlFilter_14040bc6244eae96_graphics46" align="BOTTOM" width="34" height="34" border="0"></a> <a href="http://www.youtube.com/user/MessageNetConnection/feed" style="color:rgb(17,85,204)" target="_blank"><img src="http://www.messagenetsystems.com/images/socialmediaicons/32/youtube.png" name="SafeHtmlFilter_14040bc6244eae96_graphics47" align="BOTTOM" width="34" height="34" border="0"></a> <a href="http://www.linkedin.com/company/messagenet-systems" style="color:rgb(17,85,204)" target="_blank"><img src="http://www.messagenetsystems.com/images/socialmediaicons/32/linkedin.png" name="SafeHtmlFilter_14040bc6244eae96_graphics48" align="BOTTOM" width="34" height="34" border="0"></a> <a href="http://twitter.com/MessageNet" style="color:rgb(17,85,204)" target="_blank"><img src="http://www.messagenetsystems.com/images/socialmediaicons/32/twitter.png" name="SafeHtmlFilter_14040bc6244eae96_graphics49" align="BOTTOM" width="34" height="34" border="0"></a> <a href="http://www.facebook.com/MessageNetsystems" style="color:rgb(17,85,204)" target="_blank"><img src="http://www.messagenetsystems.com/images/socialmediaicons/32/facebook.png" name="SafeHtmlFilter_14040bc6244eae96_graphics50" align="BOTTOM" width="34" height="34" border="0"></a></font></p>
</td></tr></tbody></table></div>
</div>