concat: Reset segment base offset after FLUSH_STOP with reset_time = TRUE
authorCarlos Rafael Giani <dv@pseudoterminal.org>
Thu, 11 Jun 2015 08:53:30 +0000 (10:53 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 11 Jun 2015 09:03:18 +0000 (11:03 +0200)
If the reset_time value of a FLUSH_STOP event is set to TRUE, the pipeline
will have the base_time of its elements reset. This means that the concat
element's current_start_offset has to be reset to 0, since it was
calculated with the old base-time in mind.

Only FLUSH_STOP events coming from the active pad are looked at.

Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
plugins/elements/gstconcat.c

index 63358bf..75890f2 100644 (file)
@@ -523,9 +523,16 @@ gst_concat_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
       g_mutex_lock (&self->lock);
       forward = (self->current_sinkpad == GST_PAD_CAST (spad));
       g_mutex_unlock (&self->lock);
-      if (forward)
+      if (forward) {
+        gboolean reset_time;
+        gst_event_parse_flush_stop (event, &reset_time);
+        if (reset_time) {
+          GST_DEBUG_OBJECT (self,
+              "resetting start offset to 0 after flushing with reset_time = TRUE");
+          self->current_start_offset = 0;
+        }
         ret = gst_pad_event_default (pad, parent, event);
-      else
+      else
         gst_event_unref (event);
       break;
     }