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.
This commit is contained in:
Wim Taymans 2009-02-23 17:36:23 +01:00
parent dcc6ab2cce
commit 79c3c6a339

View file

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