From 1f21747cc5d3ee65df8a5f4607720fadc38c7140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 12 Apr 2016 15:01:28 +0300 Subject: [PATCH] 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. --- gst/deinterlace/gstdeinterlace.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index e4e16542f4..65cfd92039 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -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 */