deinterlace: Drain the field history if the caps are changing

Otherwise we will use fields from the old caps with everything set up for the
new caps, causing crashes and worse.

Also don't do anything if the same caps are set twice.
This commit is contained in:
Sebastian Dröge 2016-04-12 15:01:28 +03:00
parent 0c84b1b104
commit 1f21747cc5

View file

@ -2521,9 +2521,18 @@ gst_deinterlace_setcaps (GstDeinterlace * self, GstPad * pad, GstCaps * caps)
GstCaps *srccaps = NULL;
GstVideoInterlaceMode interlacing_mode;
gint fps_n, fps_d;
GstCaps *peercaps;
GstCaps *peercaps, *current_caps;
gst_pad_check_reconfigure (self->srcpad);
if ((current_caps = gst_pad_get_current_caps (pad))) {
if (gst_caps_is_equal (caps, current_caps)) {
GST_DEBUG_OBJECT (pad, "Got same caps again, returning");
gst_caps_unref (current_caps);
return TRUE;
}
gst_deinterlace_reset_history (self, FALSE);
}
peercaps = gst_pad_peer_query_caps (self->srcpad, NULL);
/* Make sure the peer caps are compatible with the template caps */