latency tracer: add timestamp to tracer records
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 13 Apr 2017 14:28:54 +0000 (16:28 +0200)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Sat, 4 Nov 2017 17:51:00 +0000 (13:51 -0400)
Include the timestamp of the recorded log as in the 'stats' tracer.
This can be useful, for example, to plot a graph showing the latency
over time.

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

plugins/tracers/gstlatency.c

index 2d21230..a32b517 100644 (file)
@@ -106,7 +106,7 @@ log_latency (const GstStructure * data, GstPad * sink_pad, guint64 sink_ts)
   sink = g_strdup_printf ("%s_%s", GST_DEBUG_PAD_NAME (sink_pad));
 
   gst_tracer_record_log (tr_latency, src, sink,
-      GST_CLOCK_DIFF (src_ts, sink_ts));
+      GST_CLOCK_DIFF (src_ts, sink_ts), sink_ts);
   g_free (src);
   g_free (sink);
 }
@@ -216,6 +216,12 @@ gst_latency_tracer_class_init (GstLatencyTracerClass * klass)
           "min", G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
           "max", G_TYPE_UINT64, G_MAXUINT64,
           NULL),
+      "ts", GST_TYPE_STRUCTURE, gst_structure_new ("value",
+          "type", G_TYPE_GTYPE, G_TYPE_UINT64,
+          "description", G_TYPE_STRING, "ts when the latency has been logged",
+          "min", G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
+          "max", G_TYPE_UINT64, G_MAXUINT64,
+          NULL),
       NULL);
   /* *INDENT-ON* */
 }