diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 850516dba3..5cd9c6faf5 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -2366,6 +2366,9 @@ gst_base_src_default_negotiate (GstBaseSrc * basesrc) if (thiscaps == NULL || gst_caps_is_any (thiscaps)) goto no_nego_needed; + if (G_UNLIKELY (gst_caps_is_empty (thiscaps))) + goto no_caps; + /* get the peer caps */ peercaps = gst_pad_peer_get_caps (GST_BASE_SRC_PAD (basesrc)); GST_DEBUG_OBJECT (basesrc, "caps of peer: %" GST_PTR_FORMAT, peercaps); @@ -2418,6 +2421,15 @@ no_nego_needed: gst_caps_unref (thiscaps); return TRUE; } +no_caps: + { + GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT, + ("No supported formats found"), + ("This element did not produce valid caps")); + if (thiscaps) + gst_caps_unref (thiscaps); + return TRUE; + } } static gboolean