From a06a9038a4acf5277b40a4915397e97e5461bac5 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 26 Aug 2013 18:38:27 -0300 Subject: [PATCH] pad-monitor: improve serialized event checks If the event was already found at the first position of the array, it shouldn't be searched on the rest of it. This removes lots of false positives. --- .../gst/validate/gst-validate-pad-monitor.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/validate/gst/validate/gst-validate-pad-monitor.c b/validate/gst/validate/gst-validate-pad-monitor.c index f542f691d7..8a0a2d7483 100644 --- a/validate/gst/validate/gst-validate-pad-monitor.c +++ b/validate/gst/validate/gst-validate-pad-monitor.c @@ -1472,18 +1472,19 @@ gst_validate_pad_monitor_event_probe (GstPad * pad, GstEvent * event, || GST_EVENT_TYPE (event) == GST_EVENT_TYPE (next_event->event)) { g_ptr_array_remove_index (monitor->serialized_events, 0); } - } + } else { + /* if the event is not the first, it might be out of order */ + for (i = 0; i < monitor->serialized_events->len; i++) { + SerializedEventData *stored_event = + g_ptr_array_index (monitor->serialized_events, i); - for (i = 0; i < monitor->serialized_events->len; i++) { - SerializedEventData *stored_event = - g_ptr_array_index (monitor->serialized_events, i); - - if (event == stored_event->event - || GST_EVENT_TYPE (event) == GST_EVENT_TYPE (stored_event->event)) { - GST_VALIDATE_REPORT (monitor, EVENT_SERIALIZED_OUT_OF_ORDER, - "Serialized event %" GST_PTR_FORMAT " was pushed out of original " - "serialization order in pad %s:%s", event, - GST_DEBUG_PAD_NAME (GST_VALIDATE_PAD_MONITOR_GET_PAD (monitor))); + if (event == stored_event->event + || GST_EVENT_TYPE (event) == GST_EVENT_TYPE (stored_event->event)) { + GST_VALIDATE_REPORT (monitor, EVENT_SERIALIZED_OUT_OF_ORDER, + "Serialized event %" GST_PTR_FORMAT " was pushed out of original " + "serialization order in pad %s:%s", event, + GST_DEBUG_PAD_NAME (GST_VALIDATE_PAD_MONITOR_GET_PAD (monitor))); + } } } }