gst/gstpad.c: throw an error if the getcaps function does not return a subset of the template caps.

Original commit message from CVS:
* gst/gstpad.c: (gst_pad_get_caps):
throw an error if the getcaps function does not return a subset of
the template caps.
* libs/gst/bytestream/filepad.c: (gst_file_pad_chain):
make disconts without position info an error in debugging
* tests/spidey_bench.c: (handoff), (main):
don't count first try when averaging
This commit is contained in:
Benjamin Otte 2004-06-29 00:34:38 +00:00
parent f683e73dc6
commit 968c817c26
4 changed files with 42 additions and 9 deletions

View file

@ -1,3 +1,13 @@
2004-06-28 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstpad.c: (gst_pad_get_caps):
throw an error if the getcaps function does not return a subset of
the template caps.
* libs/gst/bytestream/filepad.c: (gst_file_pad_chain):
make disconts without position info an error in debugging
* tests/spidey_bench.c: (handoff), (main):
don't count first try when averaging
2004-06-26 Thomas Vander Stichele <thomas at apestaart dot org> 2004-06-26 Thomas Vander Stichele <thomas at apestaart dot org>
* docs/gst/Makefile.am: * docs/gst/Makefile.am:

View file

@ -2625,13 +2625,33 @@ gst_pad_get_caps (GstPad * pad)
if (caps == NULL) { if (caps == NULL) {
g_critical ("pad %s:%s returned NULL caps from getcaps function\n", g_critical ("pad %s:%s returned NULL caps from getcaps function\n",
GST_ELEMENT_NAME (GST_PAD_PARENT (GST_PAD (realpad))), GST_DEBUG_PAD_NAME (realpad));
GST_PAD_NAME (realpad)); } else {
caps = gst_caps_new_any (); #ifndef G_DISABLE_ASSERT
} /* check that the returned caps are a real subset of the template caps */
if (GST_PAD_PAD_TEMPLATE (realpad)) {
const GstCaps *templ_caps =
GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (realpad));
if (!gst_caps_is_subset (caps, templ_caps)) {
GstCaps *temp;
return caps; GST_CAT_ERROR_OBJECT (GST_CAT_CAPS, pad,
} else if (GST_PAD_PAD_TEMPLATE (realpad)) { "pad returned caps %" GST_PTR_FORMAT
" which are not a real subset of its template caps %"
GST_PTR_FORMAT, caps, templ_caps);
g_warning
("pad %s:%s returned caps that are not a real subset of its template caps",
GST_DEBUG_PAD_NAME (realpad));
temp = gst_caps_intersect (templ_caps, caps);
gst_caps_free (caps);
caps = temp;
}
}
#endif
return caps;
}
}
if (GST_PAD_PAD_TEMPLATE (realpad)) {
GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (realpad); GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (realpad);
const GstCaps *caps; const GstCaps *caps;

View file

@ -129,7 +129,7 @@ gst_file_pad_chain (GstPad * gst_pad, GstData * data)
GST_INFO_OBJECT (pad, "got discont to %" G_GINT64_FORMAT, value); GST_INFO_OBJECT (pad, "got discont to %" G_GINT64_FORMAT, value);
pad->position = value; pad->position = value;
} else { } else {
GST_WARNING_OBJECT (pad, "got discont without position"); GST_ERROR_OBJECT (pad, "got discont without position");
if (pad->position == -1) { if (pad->position == -1) {
GST_WARNING_OBJECT (pad, GST_WARNING_OBJECT (pad,
"need to reset position to 0 because we have no position info"); "need to reset position to 0 because we have no position info");

View file

@ -21,6 +21,7 @@
static GTimeVal start_time; static GTimeVal start_time;
gboolean done = FALSE; gboolean done = FALSE;
GstClockTime total = 0; GstClockTime total = 0;
guint counted = 0;
static void static void
handoff (GstElement * fakesink, GstBuffer * data) handoff (GstElement * fakesink, GstBuffer * data)
@ -37,7 +38,9 @@ handoff (GstElement * fakesink, GstBuffer * data)
g_print ("time to launch spider pipeline: %" GST_TIME_FORMAT "\n", g_print ("time to launch spider pipeline: %" GST_TIME_FORMAT "\n",
GST_TIME_ARGS (diff)); GST_TIME_ARGS (diff));
done = TRUE; done = TRUE;
total += diff; /* don't count first try, it loads the plugins */
if (counted++)
total += diff;
} }
gint gint
@ -61,7 +64,7 @@ main (gint argc, gchar * argv[])
("filesrc location=\"%s\" ! spider ! audio/x-raw-int ! fakesink name = sink", ("filesrc location=\"%s\" ! spider ! audio/x-raw-int ! fakesink name = sink",
file); file);
for (i = 0; i < count; i++) { for (i = 0; i <= count; i++) {
GstElement *sink; GstElement *sink;
g_get_current_time (&start_time); g_get_current_time (&start_time);