summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2020-09-17 17:39:25 -0400
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-10-04 00:50:01 +0000
commitadeb2311fa75a2f1cb468e5293d468f3d359f386 (patch)
treee7c328a8275e8ee76016ee7c984be1b1c968e120
parent7bf0311bf568c9af01908b9e8016cbd1f06a7053 (diff)
downloadgstreamer-plugins-bad-adeb2311fa75a2f1cb468e5293d468f3d359f386.tar.gz
kmssink: Do not source using padded width/height
The width/height from the video meta can be padded width, height. But when sourcing from padded buffer, we only want to use the valid pixels. This rectangle is from the crop meta, orther it is deduces from the caps. The width and height from the caps is save in the parent class, use these instead of the GstVideoInfo when settting the src rectangle. This fixes an issue with 1080p video displaying repeated or green at the padded bottom 8 lines (seen with v4l2codecs). Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1642>
-rw-r--r--sys/kms/gstkmssink.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c
index e9e3fe997..db983439e 100644
--- a/sys/kms/gstkmssink.c
+++ b/sys/kms/gstkmssink.c
@@ -1569,6 +1569,7 @@ gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
GstVideoInfo *vinfo;
GstVideoCropMeta *crop;
GstVideoRectangle src = { 0, };
+ gint video_width, video_height;
GstVideoRectangle dst = { 0, };
GstVideoRectangle result;
GstFlowReturn res;
@@ -1580,13 +1581,13 @@ gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
if (buf) {
buffer = gst_kms_sink_get_input_buffer (self, buf);
vinfo = &self->vinfo;
- src.w = GST_VIDEO_SINK_WIDTH (self);
- src.h = GST_VIDEO_SINK_HEIGHT (self);
+ video_width = src.w = GST_VIDEO_SINK_WIDTH (self);
+ video_height = src.h = GST_VIDEO_SINK_HEIGHT (self);
} else if (self->last_buffer) {
buffer = gst_buffer_ref (self->last_buffer);
vinfo = &self->last_vinfo;
- src.w = self->last_width;
- src.h = self->last_height;
+ video_width = src.w = self->last_width;
+ video_height = src.h = self->last_height;
}
/* Make sure buf is not used accidentally */
@@ -1633,8 +1634,8 @@ retry_set_plane:
src.w = crop->width;
src.h = crop->height;
} else {
- src.w = GST_VIDEO_INFO_WIDTH (vinfo);
- src.h = GST_VIDEO_INFO_HEIGHT (vinfo);
+ src.w = video_width;
+ src.h = video_height;
}
/* handle out of screen case */