interlace: Reset after changing state to READY

Trying to reset before the pads have been deactivated races with the
streaming thread. There was also a buggy buffer clear leaving a dangling
`stored_frame` pointer around. Use `gst_interlace_reset` so this happens
properly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1039>
This commit is contained in:
Jan Alexander Steffens (heftig) 2021-10-21 00:31:24 +02:00 committed by GStreamer Marge Bot
parent 2f8030d98b
commit fcaf5b0f0b

View file

@ -1514,23 +1514,23 @@ static GstStateChangeReturn
gst_interlace_change_state (GstElement * element, GstStateChange transition) gst_interlace_change_state (GstElement * element, GstStateChange transition)
{ {
GstInterlace *interlace = GST_INTERLACE (element); GstInterlace *interlace = GST_INTERLACE (element);
GstStateChangeReturn ret;
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
g_mutex_lock (&interlace->lock); g_mutex_lock (&interlace->lock);
interlace->src_fps_n = 0; interlace->src_fps_n = 0;
if (interlace->stored_frame) {
gst_buffer_unref (interlace->stored_frame);
}
g_mutex_unlock (&interlace->lock); g_mutex_unlock (&interlace->lock);
/* why? */
//gst_interlace_reset (interlace); gst_interlace_reset (interlace);
break; break;
default: default:
break; break;
} }
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); return ret;
} }
static gboolean static gboolean