From 5470f6df00595f4ab44871e0e633bf15006abc5c Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Mon, 18 Mar 2019 21:55:50 -0400 Subject: [PATCH] latency: Dot not override already stored events First, the event would be leaved, but also when an element takes several buffers before producing one, we want the reported latency to be the aggregation, so the distance from the oldest buffer. --- plugins/tracers/gstlatency.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/tracers/gstlatency.c b/plugins/tracers/gstlatency.c index bb6aedf..3b774e9 100644 --- a/plugins/tracers/gstlatency.c +++ b/plugins/tracers/gstlatency.c @@ -300,8 +300,9 @@ do_push_event_pre (GstTracer * self, guint64 ts, GstPad * pad, GstEvent * ev) /* store event so that we can calculate latency when the buffer that * follows has been processed */ - g_object_set_qdata ((GObject *) pad, latency_probe_id, - gst_event_ref (ev)); + if (!g_object_get_qdata ((GObject *) pad, latency_probe_id)) + g_object_set_qdata ((GObject *) pad, latency_probe_id, + gst_event_ref (ev)); } } @@ -314,8 +315,9 @@ do_push_event_pre (GstTracer * self, guint64 ts, GstPad * pad, GstEvent * ev) if (!g_str_equal (g_value_get_string (value), pad_name)) { GST_DEBUG ("%s: Storing sub-latency event", pad_name); - g_object_set_qdata ((GObject *) pad, sub_latency_probe_id, - gst_event_ref (ev)); + if (!g_object_get_qdata ((GObject *) pad, sub_latency_probe_id)) + g_object_set_qdata ((GObject *) pad, sub_latency_probe_id, + gst_event_ref (ev)); } g_free (pad_name); -- 2.7.4