typefind: Send stream-start before anything else
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Mon, 6 May 2013 22:47:44 +0000 (18:47 -0400)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 7 May 2013 07:17:13 +0000 (09:17 +0200)
To do so, send stream-start when the streaming thread goes up for the first
time.

https://bugzilla.gnome.org/show_bug.cgi?id=699767

plugins/elements/gsttypefindelement.c

index e9e849e..89885a4 100644 (file)
@@ -979,6 +979,19 @@ gst_type_find_element_loop (GstPad * pad)
 
   typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
 
+  if (typefind->need_stream_start) {
+    gchar *stream_id;
+
+    stream_id = gst_pad_create_stream_id (typefind->src,
+        GST_ELEMENT_CAST (typefind), NULL);
+
+    GST_DEBUG_OBJECT (typefind, "Pushing STREAM_START");
+    gst_pad_push_event (typefind->src, gst_event_new_stream_start (stream_id));
+
+    typefind->need_stream_start = FALSE;
+    g_free (stream_id);
+  }
+
   if (typefind->mode == MODE_TYPEFIND) {
     GstPad *peer;
     GstCaps *found_caps = NULL;
@@ -1044,21 +1057,6 @@ gst_type_find_element_loop (GstPad * pad)
   } else if (typefind->mode == MODE_NORMAL) {
     GstBuffer *outbuf = NULL;
 
-    if (typefind->need_stream_start) {
-      gchar *stream_id;
-
-      stream_id =
-          gst_pad_create_stream_id (typefind->src, GST_ELEMENT_CAST (typefind),
-          NULL);
-
-      GST_DEBUG_OBJECT (typefind, "Pushing STREAM_START");
-      gst_pad_push_event (typefind->src,
-          gst_event_new_stream_start (stream_id));
-
-      typefind->need_stream_start = FALSE;
-      g_free (stream_id);
-    }
-
     if (typefind->need_segment) {
       typefind->need_segment = FALSE;
       gst_pad_push_event (typefind->src,