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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1333>
This commit is contained in:
Vivia Nikolaidou 2020-06-11 13:50:38 +03:00 committed by GStreamer Merge Bot
parent 7ab51e85ab
commit 969e647925

View file

@ -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) ==