From 18c9babef93abda5572d6f66979de6bb587ed393 Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Wed, 12 Dec 2018 15:48:09 +0100
Subject: [PATCH] glupload: dmabuf: use out_info to create allocation params
for non-direct dmabuf uploads as well
Non-direct dmabuf uploads, just as direct dmabuf uploads, create EGL
images and thus GL textures of the same width as the imported image.
The input dmabuf line stride is not relevant to the resulting texture
in both cases.
This fixes the case where non-direct uploads of input dmabufs with line
stride larger than the width will for example cause glcolorconvert to
sample only the left part (width * bytes per pixel / stride) of the
image, causing a horizontally stretched and cropped output image.
---
gst-libs/gst/gl/gstglupload.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
index 26d2a9f8fa..f1108f4be1 100644
--- a/gst-libs/gst/gl/gstglupload.c
+++ b/gst-libs/gst/gl/gstglupload.c
@@ -609,7 +609,7 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
{
struct DmabufUpload *dmabuf = impl;
GstVideoInfo *in_info = &dmabuf->upload->priv->in_info;
- GstVideoInfo *out_info = in_info;
+ GstVideoInfo *out_info = &dmabuf->out_info;
guint n_planes = GST_VIDEO_INFO_N_PLANES (in_info);
GstVideoMeta *meta;
guint n_mem;
@@ -649,13 +649,10 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
}
}
- if (dmabuf->direct) {
- if (out_caps != dmabuf->out_caps) {
- dmabuf->out_caps = out_caps;
- if (!gst_video_info_from_caps (&dmabuf->out_info, out_caps))
- return FALSE;
- }
- out_info = &dmabuf->out_info;
+ if (out_caps != dmabuf->out_caps) {
+ dmabuf->out_caps = out_caps;
+ if (!gst_video_info_from_caps (out_info, out_caps))
+ return FALSE;
}
if (dmabuf->params)