gst/gstpad.c: add sophisticated error checking code to see if fixation functions did their fixation right

Original commit message from CVS:
* gst/gstpad.c: (gst_pad_link_fixate):
add sophisticated error checking code to see if fixation functions
did their fixation right
This commit is contained in:
Benjamin Otte 2004-04-21 04:08:19 +00:00
parent 614b4d1627
commit 6d8c433fa8
2 changed files with 41 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2004-04-21 Benjamin Otte <otte@gnome.org>
* gst/gstpad.c: (gst_pad_link_fixate):
add sophisticated error checking code to see if fixation functions
did their fixation right
2004-04-21 Benjamin Otte <otte@gnome.org>
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):

View file

@ -1196,9 +1196,41 @@ gst_pad_link_fixate (GstPadLink * link)
break;
}
if (newcaps) {
gst_caps_free (caps);
caps = newcaps;
break;
#ifndef G_DISABLE_CHECKS
/* some mad checking for correctly working fixation functions */
gboolean bad;
if (i == 4) {
/* we trust the default fixation function unconditionally */
bad = FALSE;
} else if (gst_caps_is_any (caps)) {
bad = gst_caps_is_any (newcaps);
} else {
GstCaps *test = gst_caps_subtract (caps, newcaps);
bad = gst_caps_is_empty (test);
gst_caps_free (test);
/* simplifying is ok, too */
if (bad)
bad = (gst_caps_get_size (newcaps) >= gst_caps_get_size (caps));
}
if (bad) {
gchar *newcaps_str = gst_caps_to_string (newcaps);
gchar *caps_str = gst_caps_to_string (caps);
g_warning
("a fixation function did not fixate correctly, the returned caps %s are no true subset of %s.",
newcaps_str, caps_str);
g_free (newcaps_str);
g_free (caps_str);
gst_caps_free (newcaps);
} else
#endif
{
gst_caps_free (caps);
caps = newcaps;
break;
}
}
}
}