typefind: Forward events that should happen before the caps event directly
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 29 Apr 2013 10:48:29 +0000 (12:48 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 29 Apr 2013 11:24:56 +0000 (13:24 +0200)
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

index 3a89c3d..932ddfe 100644 (file)
@@ -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;