compositor: fix drawing of transparent background

When drawing the background multithreaded, y_start needs to be
scaled to obtain the correct byte offset from which to start
memsetting (yoffset).

Fixes #871

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1042>
This commit is contained in:
Mathieu Duponchelle 2021-02-18 16:16:33 +01:00 committed by GStreamer Merge Bot
parent 11b5ebd058
commit dd71f359be

View file

@ -1124,6 +1124,7 @@ _draw_background (GstCompositor * comp, GstVideoFrame * outframe,
const GstVideoFormatInfo *info;
guint8 *pdata;
gsize rowsize, plane_stride;
gint yoffset;
info = outframe->info.finfo;
pdata = GST_VIDEO_FRAME_PLANE_DATA (outframe, plane);
@ -1131,8 +1132,11 @@ _draw_background (GstCompositor * comp, GstVideoFrame * outframe,
rowsize = GST_VIDEO_FRAME_COMP_WIDTH (outframe, plane)
* GST_VIDEO_FRAME_COMP_PSTRIDE (outframe, plane);
height =
GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info, plane, y_end - y_start);
pdata += y_start * plane_stride;
GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info, plane, (y_end - y_start));
yoffset = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info, plane, y_start);
pdata += yoffset * plane_stride;
for (i = 0; i < height; ++i) {
memset (pdata, 0, rowsize);
pdata += plane_stride;