From 969e6479252b787e37c62408464f050099565c5c Mon Sep 17 00:00:00 2001 From: Vivia Nikolaidou Date: Thu, 11 Jun 2020 13:50:38 +0300 Subject: [PATCH] interlace: Fix crash with empty caps in setcaps If the src_peer_caps are EMPTY (e.g. negotiation failed somewhere), the assertion inside gst_video_info_from_caps would fail and the whole pipeline would crash. Check for gst_caps_is_empty before gst_video_info_from_caps and gracefully fail if it's empty. Part-of: --- gst/interlace/gstinterlace.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gst/interlace/gstinterlace.c b/gst/interlace/gstinterlace.c index 635a99b..a15de74 100644 --- a/gst/interlace/gstinterlace.c +++ b/gst/interlace/gstinterlace.c @@ -427,8 +427,14 @@ gst_interlace_setcaps (GstInterlace * interlace, GstCaps * caps) src_peer_caps = gst_pad_peer_query_caps (interlace->srcpad, othercaps); gst_caps_unref (othercaps); othercaps = gst_caps_fixate (src_peer_caps); - if (!gst_video_info_from_caps (&out_info, othercaps)) + if (gst_caps_is_empty (othercaps)) { + gst_caps_unref (othercaps); goto caps_error; + } + if (!gst_video_info_from_caps (&out_info, othercaps)) { + gst_caps_unref (othercaps); + goto caps_error; + } alternate = GST_VIDEO_INFO_INTERLACE_MODE (&out_info) == -- 2.7.4