From: Sebastian Dröge Date: Mon, 15 May 2017 13:37:14 +0000 (+0300) Subject: decklinkvideosink: Copy min(gstreamer_stride, decklink_stride) per line X-Git-Tag: accepted/tizen/unified/20220217.153506~2^2~10^2~9^2~12^2~2^2~111^2~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f98403ca6b6ff84967375a468db2798b93488896;p=platform%2Fupstream%2Fgstreamer.git decklinkvideosink: Copy min(gstreamer_stride, decklink_stride) per line Instead of just bpp * width, which might be more than we can copy. --- diff --git a/sys/decklink/gstdecklinkvideosink.cpp b/sys/decklink/gstdecklinkvideosink.cpp index 7586bc3..78f5726 100644 --- a/sys/decklink/gstdecklinkvideosink.cpp +++ b/sys/decklink/gstdecklinkvideosink.cpp @@ -556,7 +556,7 @@ gst_decklink_video_sink_prepare (GstBaseSink * bsink, GstBuffer * buffer) gint i; GstDecklinkVideoFormat caps_format; BMDPixelFormat format; - gint bpp; + gint stride; GstVideoTimeCodeMeta *tc_meta; GST_DEBUG_OBJECT (self, "Preparing buffer %p", buffer); @@ -568,7 +568,6 @@ gst_decklink_video_sink_prepare (GstBaseSink * bsink, GstBuffer * buffer) caps_format = gst_decklink_type_from_video_format (self->info.finfo->format); format = gst_decklink_pixel_format_from_type (caps_format); - bpp = gst_decklink_bpp_from_type (caps_format); timestamp = GST_BUFFER_TIMESTAMP (buffer); duration = GST_BUFFER_DURATION (buffer); @@ -623,8 +622,9 @@ gst_decklink_video_sink_prepare (GstBaseSink * bsink, GstBuffer * buffer) frame->GetBytes ((void **) &outdata); indata = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (&vframe, 0); + stride = MIN (GST_VIDEO_FRAME_PLANE_STRIDE (&vframe, 0), frame->GetRowBytes()); for (i = 0; i < self->info.height; i++) { - memcpy (outdata, indata, GST_VIDEO_FRAME_WIDTH (&vframe) * bpp); + memcpy (outdata, indata, stride); indata += GST_VIDEO_FRAME_PLANE_STRIDE (&vframe, 0); outdata += frame->GetRowBytes (); }