mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 10:40:34 +00:00
plugins/elements/gsttypefindelement.c: When typefinding is unsuccessful in the chain function, don't error out immedi...
Original commit message from CVS: * 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.
This commit is contained in:
parent
63245ea1bb
commit
573b793f08
2 changed files with 32 additions and 3 deletions
13
ChangeLog
13
ChangeLog
|
@ -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 <wim@fluendo.com>
|
||||
|
||||
* docs/gst/gstreamer-sections.txt:
|
||||
|
|
|
@ -82,6 +82,11 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
|||
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 @@ gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer)
|
|||
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 @@ gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer)
|
|||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue