From 79c3c6a3390d846ba7e47248f9b6bb7f8d6b1409 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 23 Feb 2009 17:36:23 +0100 Subject: [PATCH] Error out more specifically on empty caps When we get empty caps from the getcaps function in the default negotiate function, post a more descriptive error. --- libs/gst/base/gstbasesrc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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