glupload: Recalculate offset and size in raw upload

As we only expose the mapped portion of the frame into the GL
memory object (and not the original padding) we need to
re-calculate the size and offset.
This commit is contained in:
Nicolas Dufresne 2015-08-16 18:13:12 +02:00 committed by Tim-Philipp Müller
parent 7e62a38569
commit edd3c007ea

View file

@ -714,6 +714,8 @@ static struct RawUploadFrame *
_raw_upload_frame_new (struct RawUpload *raw, GstBuffer * buffer)
{
struct RawUploadFrame *frame;
GstVideoInfo *info;
gint i;
if (!buffer)
return NULL;
@ -728,6 +730,14 @@ _raw_upload_frame_new (struct RawUpload *raw, GstBuffer * buffer)
}
raw->upload->priv->in_info = frame->frame.info;
info = &raw->upload->priv->in_info;
/* Recalculate the offsets (and size) */
info->size = 0;
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) {
info->offset[i] = info->size;
info->size += gst_gl_get_plane_data_size (info, NULL, i);
}
return frame;
}