typefindelement: reset segment only once streaming has stopped
authorTim-Philipp Müller <tim@centricular.com>
Sun, 14 Jun 2015 19:48:29 +0000 (20:48 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sun, 14 Jun 2015 20:25:29 +0000 (21:25 +0100)
Fixes the occasional criticals in the discoverer unit test.

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

plugins/elements/gsttypefindelement.c

index df58627..f9d3e37 100644 (file)
@@ -1196,17 +1196,18 @@ gst_type_find_element_activate_sink_mode (GstPad * pad, GstObject * parent,
         typefind->offset = 0;
         res = TRUE;
       } else {
-        gst_segment_init (&typefind->segment, GST_FORMAT_UNDEFINED);
         res = gst_pad_stop_task (pad);
+        gst_segment_init (&typefind->segment, GST_FORMAT_UNDEFINED);
       }
       break;
     case GST_PAD_MODE_PUSH:
-      gst_segment_init (&typefind->segment, GST_FORMAT_UNDEFINED);
-      if (active)
+      if (active) {
+        gst_segment_init (&typefind->segment, GST_FORMAT_UNDEFINED);
         start_typefinding (typefind);
-      else
+      } else {
         stop_typefinding (typefind);
-
+        gst_segment_init (&typefind->segment, GST_FORMAT_UNDEFINED);
+      }
       res = TRUE;
       break;
     default: