event: Update running time in QoS based on the pad offsets
authorSebastian Dröge <sebastian@centricular.com>
Fri, 4 Apr 2014 15:28:23 +0000 (17:28 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 10 Apr 2014 06:25:50 +0000 (08:25 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=722697

gst/gstevent.c

index f31d3ed..7289bbd 100644 (file)
@@ -1030,6 +1030,8 @@ gst_event_new_qos (GstQOSType type, gdouble proportion,
  *
  * Get the type, proportion, diff and timestamp in the qos event. See
  * gst_event_new_qos() for more information about the different QoS values.
+ *
+ * @timestamp will be adjusted for any pad offsets of pads it was passing through.
  */
 void
 gst_event_parse_qos (GstEvent * event, GstQOSType * type,
@@ -1053,10 +1055,18 @@ gst_event_parse_qos (GstEvent * event, GstQOSType * type,
     *diff =
         g_value_get_int64 (gst_structure_id_get_value (structure,
             GST_QUARK (DIFF)));
-  if (timestamp)
+  if (timestamp) {
+    gint64 offset = gst_event_get_running_time_offset (event);
+
     *timestamp =
         g_value_get_uint64 (gst_structure_id_get_value (structure,
             GST_QUARK (TIMESTAMP)));
+    /* Catch underflows */
+    if (*timestamp > -offset)
+      *timestamp += offset;
+    else
+      *timestamp = 0;
+  }
 }
 
 /**