From 211b8b60043592467ac47ab4058a67da32bce69e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 20 Aug 2012 16:17:27 +0200 Subject: [PATCH] video-frame: only copy the visible region Make sure to only copy the visible region instead of assuming that the complete stride is visible (which is not the case when padding is used). --- gst-libs/gst/video/video-frame.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/video/video-frame.c b/gst-libs/gst/video/video-frame.c index 5ddcd781db..1bfc777698 100644 --- a/gst-libs/gst/video/video-frame.c +++ b/gst-libs/gst/video/video-frame.c @@ -230,7 +230,10 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src, ss = sinfo->stride[plane]; ds = dinfo->stride[plane]; - w = MIN (ABS (ss), ABS (ds)); + /* 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); h = GST_VIDEO_FRAME_COMP_HEIGHT (dest, plane); GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy plane %d, w:%d h:%d ", plane, w, h);