kmssink: Save last metadata at the same time as the last buffer

The render width/height and the vinfo was only saved upon renegotiation. This
fixes the problem by saving this metadata at the same time the buffer is
saved. The saved copy of this is needed for expose() and drain() virtual functions.
This fixes various assertion that happens on drain query.
This commit is contained in:
Nicolas Dufresne 2020-04-14 17:10:34 -04:00 committed by GStreamer Merge Bot
parent 1fb57155ff
commit 63940feaaf

View file

@ -1123,10 +1123,6 @@ gst_kms_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
if (!gst_video_info_from_caps (&vinfo, caps))
goto invalid_format;
self->last_width = GST_VIDEO_SINK_WIDTH (self);
self->last_height = GST_VIDEO_SINK_HEIGHT (self);
self->last_vinfo = self->vinfo;
self->vinfo = vinfo;
if (!gst_kms_sink_calculate_display_ratio (self, &vinfo,
@ -1676,8 +1672,13 @@ sync_frame:
goto bail;
}
if (buffer != self->last_buffer)
/* Save the rendered buffer and its metadata in case a redraw is needed */
if (buffer != self->last_buffer) {
gst_buffer_replace (&self->last_buffer, buffer);
self->last_width = GST_VIDEO_SINK_WIDTH (self);
self->last_height = GST_VIDEO_SINK_HEIGHT (self);
self->last_vinfo = self->vinfo;
}
g_clear_pointer (&self->tmp_kmsmem, gst_memory_unref);
GST_OBJECT_UNLOCK (self);