Commit f5e0321d authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠

videomixer: clear video frame more correctly

Make sure not to touch memory that doesn't belong to
our frame, we might be one part of a side-by-side 3D
frame, or in a picture-in-picture scenario.
parent c203ce2d
......@@ -837,11 +837,23 @@ gst_videomixer2_blend_buffers (GstVideoMixer2 * mix,
break;
case VIDEO_MIXER2_BACKGROUND_TRANSPARENT:
{
guint i, num_maps;
num_maps = (outframe.meta) ? GST_VIDEO_FRAME_N_PLANES (&outframe) : 1;
for (i = 0; i < num_maps; ++i)
memset (outframe.map[i].data, 0, outframe.map[i].size);
guint i, plane, num_planes, height;
num_planes = GST_VIDEO_FRAME_N_PLANES (&outframe);
for (plane = 0; plane < num_planes; ++plane) {
guint8 *pdata;
gsize rowsize, plane_stride;
pdata = GST_VIDEO_FRAME_PLANE_DATA (&outframe, plane);
plane_stride = GST_VIDEO_FRAME_PLANE_STRIDE (&outframe, plane);
rowsize = GST_VIDEO_FRAME_COMP_WIDTH (&outframe, plane)
* GST_VIDEO_FRAME_COMP_PSTRIDE (&outframe, plane);
height = GST_VIDEO_FRAME_COMP_HEIGHT (&outframe, plane);
for (i = 0; i < height; ++i) {
memset (pdata, 0, rowsize);
pdata += plane_stride;
}
}
/* use overlay to keep background transparent */
composite = mix->overlay;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment