From: <tp...@fr...> - 2006-02-14 21:01:00
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: tpm Date: Tue Feb 14 2006 12:57:43 PST Log message: * plugins/elements/gsttypefindelement.c: (gst_type_find_element_chain): When typefinding is unsuccessful in the chain function, don't error out immediately. Only error out with NO_CAPS_FOUND if the amount of data is at least MAX_TYPEFIND_SIZE bytes, otherwise simply wait for more data so we can try typefinding again with more data later. Also, don't attempt to typefind if we have less than MIN_TYPEFIND_SIZE data available. Overall, this should improve typefinding from network sources where the size of the first buffer can be somewhat random. Modified files: . : ChangeLog plugins/elements: gsttypefindelement.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.2277&r2=1.2278 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/plugins/elements/gsttypefindelement.c.diff?r1=1.63&r2=1.64 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.2277 retrieving revision 1.2278 diff -u -d -r1.2277 -r1.2278 --- ChangeLog 14 Feb 2006 18:26:18 -0000 1.2277 +++ ChangeLog 14 Feb 2006 20:57:31 -0000 1.2278 @@ -1,3 +1,16 @@ +2006-02-14 Tim-Philipp Müller <tim at centricular dot net> + + * plugins/elements/gsttypefindelement.c: + (gst_type_find_element_chain): + When typefinding is unsuccessful in the chain function, don't + error out immediately. Only error out with NO_CAPS_FOUND if + the amount of data is at least MAX_TYPEFIND_SIZE bytes, + otherwise simply wait for more data so we can try typefinding + again with more data later. Also, don't attempt to typefind + if we have less than MIN_TYPEFIND_SIZE data available. Overall, + this should improve typefinding from network sources where the + size of the first buffer can be somewhat random. 2006-02-14 Wim Taymans <wi...@fl...> * docs/gst/gstreamer-sections.txt: Index: gsttypefindelement.c RCS file: /cvs/gstreamer/gstreamer/plugins/elements/gsttypefindelement.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- gsttypefindelement.c 3 Feb 2006 21:14:57 -0000 1.63 +++ gsttypefindelement.c 14 Feb 2006 20:57:31 -0000 1.64 @@ -82,6 +82,11 @@ GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); +/* Require at least 2kB of data before we attempt typefinding in chain-mode. + * 128kB is massive overkill for the maximum, but doesn't do any harm */ +#define TYPE_FIND_MIN_SIZE (2*1024) +#define TYPE_FIND_MAX_SIZE (128*1024) /* TypeFind signals and args */ enum { @@ -678,6 +683,11 @@ else typefind->store = buffer; + if (GST_BUFFER_SIZE (typefind->store) < TYPE_FIND_MIN_SIZE) { + GST_DEBUG_OBJECT (typefind, "not enough data for typefinding yet"); + return GST_FLOW_OK; + } if (typefind->possibilities == NULL) { /* not yet started, get all typefinding functions into our "queue" */ GList *all_factories = gst_type_find_factory_get_list (); @@ -753,9 +763,15 @@ if (typefind->caps) { stop_typefinding (typefind); } else if (typefind->possibilities == NULL) { - GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL)); - stop_typefinding (typefind); - return GST_FLOW_ERROR; + if (GST_BUFFER_SIZE (typefind->store) > TYPE_FIND_MAX_SIZE) { + GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL)); + stop_typefinding (typefind); + return GST_FLOW_ERROR; + } else { + GST_DEBUG_OBJECT (typefind, "no type found with %u bytes - waiting " + "for more data", GST_BUFFER_SIZE (typefind->store)); + return GST_FLOW_OK; + } } else if (done) { TypeFindEntry *best; |