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/1580>
This commit is contained in:
Nicolas Dufresne 2020-09-17 17:39:25 -04:00 committed by GStreamer Merge Bot
parent ea24a2e527
commit 671d9fed3a

View File

@ -1569,6 +1569,7 @@ gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
GstVideoInfo *vinfo; GstVideoInfo *vinfo;
GstVideoCropMeta *crop; GstVideoCropMeta *crop;
GstVideoRectangle src = { 0, }; GstVideoRectangle src = { 0, };
gint video_width, video_height;
GstVideoRectangle dst = { 0, }; GstVideoRectangle dst = { 0, };
GstVideoRectangle result; GstVideoRectangle result;
GstFlowReturn res; GstFlowReturn res;
@ -1580,13 +1581,13 @@ gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
if (buf) { if (buf) {
buffer = gst_kms_sink_get_input_buffer (self, buf); buffer = gst_kms_sink_get_input_buffer (self, buf);
vinfo = &self->vinfo; vinfo = &self->vinfo;
src.w = GST_VIDEO_SINK_WIDTH (self); video_width = src.w = GST_VIDEO_SINK_WIDTH (self);
src.h = GST_VIDEO_SINK_HEIGHT (self); video_height = src.h = GST_VIDEO_SINK_HEIGHT (self);
} else if (self->last_buffer) { } else if (self->last_buffer) {
buffer = gst_buffer_ref (self->last_buffer); buffer = gst_buffer_ref (self->last_buffer);
vinfo = &self->last_vinfo; vinfo = &self->last_vinfo;
src.w = self->last_width; video_width = src.w = self->last_width;
src.h = self->last_height; video_height = src.h = self->last_height;
} }
/* Make sure buf is not used accidentally */ /* Make sure buf is not used accidentally */
@ -1633,8 +1634,8 @@ retry_set_plane:
src.w = crop->width; src.w = crop->width;
src.h = crop->height; src.h = crop->height;
} else { } else {
src.w = GST_VIDEO_INFO_WIDTH (vinfo); src.w = video_width;
src.h = GST_VIDEO_INFO_HEIGHT (vinfo); src.h = video_height;
} }
/* handle out of screen case */ /* handle out of screen case */