From: Tim-Philipp Müller Date: Wed, 26 Sep 2012 08:28:59 +0000 (+0100) Subject: videomixer: clear video frame more correctly X-Git-Tag: 1.19.3~509^2~6494 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f5e0321dfc4e59ed0d48eeb662297ac328d612ed;p=platform%2Fupstream%2Fgstreamer.git 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. --- diff --git a/gst/videomixer/videomixer2.c b/gst/videomixer/videomixer2.c index f3d0f80..5d42834 100644 --- a/gst/videomixer/videomixer2.c +++ b/gst/videomixer/videomixer2.c @@ -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;