GNOME Bugzilla – Bug 767645
Unallocated memory access in OpenGlSurfacePainter
Last modified: 2018-05-04 12:41:56 UTC
Created attachment 329776 [details] [review] quick fix The Qt application on our custom embedded platform (imx6, analogue camera input - format I420) kept crashing about 50% of the time when no camera was attached. After investigation I found that only 518400 was allocated, instead of the 622080 assumed. When the camera is connected, it does indeed allocate 622080. As I am not an expert in hardware or GStreamer, I don't know if the error is in the video driver or that indeed it is a bug that no size is given with the data pointer. See the patch for the solution that worked for us.
Review of attachment 329776 [details] [review]: In general getting the strides, offsets, etc should be done with the GstVideoInfo and/or GstVideoFrame API. That will always give you the correct values and you don't have to implement the conversions yourself. ::: elements/gstqtvideosink/delegates/qtvideosinkdelegate.cpp @@ +108,3 @@ GstMapInfo mem_info; if (gst_buffer_map(m_buffer, &mem_info, GST_MAP_READ)) { + m_painter->paint(mem_info.data, gst_buffer_get_size(m_buffer), m_bufferFormat, You can use mem_info.size here
Thanks for reporting, but sorry, this sounds wrong. If the upstream element is producing something else than what the caps say, then it should at least re-negotiate. It's true though that qtvideosink should be using GstVideoMeta to discover the stride, offset, etc, but even in that case, I don't think it's valid to produce a "raw" frame with less pixels than what the caps say.