From 1fb85733f5dbc28aa113729d5b3f561ee1a34526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 24 Sep 2015 11:33:24 +0200 Subject: [PATCH] video-frame: Fix gst_video_frame_copy() for formats with pstride==0 v210, UYVP and IYU1 are complex formats for which pixel stride does not really have a meaning. If we copy width*pstride bytes per line, it's not going to do the right thing. As a fallback, copy stride bytes per line. This might copy uninitialized bytes at the end of each line, but at least copies the frame. https://bugzilla.gnome.org/show_bug.cgi?id=755392 --- gst-libs/gst/video/video-frame.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/video/video-frame.c b/gst-libs/gst/video/video-frame.c index f05958c681..9323784223 100644 --- a/gst-libs/gst/video/video-frame.c +++ b/gst-libs/gst/video/video-frame.c @@ -262,10 +262,16 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src, return TRUE; } - /* FIXME. assumes subsampling of component N is the same as plane N, which is + /* FIXME: assumes subsampling of component N is the same as plane N, which is * currently true for all formats we have but it might not be in the future. */ w = GST_VIDEO_FRAME_COMP_WIDTH (dest, plane) * GST_VIDEO_FRAME_COMP_PSTRIDE (dest, plane); + /* FIXME: workaround for complex formats like v210, UYVP and IYU1 that have + * pstride == 0 */ + if (w == 0) + w = MIN (GST_VIDEO_INFO_PLANE_STRIDE (dinfo, plane), + GST_VIDEO_INFO_PLANE_STRIDE (sinfo, plane)); + h = GST_VIDEO_FRAME_COMP_HEIGHT (dest, plane); ss = GST_VIDEO_INFO_PLANE_STRIDE (sinfo, plane);