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
This commit is contained in:
Sebastian Dröge 2015-09-24 11:33:24 +02:00
parent 94e0279c44
commit 1fb85733f5

View file

@ -262,10 +262,16 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src,
return TRUE; 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. */ * currently true for all formats we have but it might not be in the future. */
w = GST_VIDEO_FRAME_COMP_WIDTH (dest, w = GST_VIDEO_FRAME_COMP_WIDTH (dest,
plane) * GST_VIDEO_FRAME_COMP_PSTRIDE (dest, plane); 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); h = GST_VIDEO_FRAME_COMP_HEIGHT (dest, plane);
ss = GST_VIDEO_INFO_PLANE_STRIDE (sinfo, plane); ss = GST_VIDEO_INFO_PLANE_STRIDE (sinfo, plane);