From fc4105c1f9d3e751ecba2ab45a05360632da853b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 29 Apr 2013 12:48:29 +0200 Subject: [PATCH] typefind: Forward events that should happen before the caps event directly There's no point in storing them and sending them later, and doing so would later require to distinguish between events that should come before caps and after. https://bugzilla.gnome.org/show_bug.cgi?id=692784 --- plugins/elements/gsttypefindelement.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 3a89c3d..932ddfe 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -644,13 +644,22 @@ gst_type_find_element_sink_event (GstPad * pad, GstObject * parent, res = gst_pad_push_event (typefind->src, event); break; default: - GST_DEBUG_OBJECT (typefind, "Saving %s event to send later", - GST_EVENT_TYPE_NAME (event)); - GST_OBJECT_LOCK (typefind); - typefind->cached_events = - g_list_append (typefind->cached_events, event); - GST_OBJECT_UNLOCK (typefind); - res = TRUE; + /* Forward events that would happen before the caps event + * directly instead of storing them. There's no reason not + * to send them directly and we should only store events + * for later sending that would need to come after the caps + * event */ + if (GST_EVENT_TYPE (event) < GST_EVENT_CAPS) { + res = gst_pad_push_event (typefind->src, event); + } else { + GST_DEBUG_OBJECT (typefind, "Saving %s event to send later", + GST_EVENT_TYPE_NAME (event)); + GST_OBJECT_LOCK (typefind); + typefind->cached_events = + g_list_append (typefind->cached_events, event); + GST_OBJECT_UNLOCK (typefind); + res = TRUE; + } break; } break; -- 2.7.4