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.
This commit is contained in:
Thiago Santos 2013-08-26 18:38:27 -03:00
parent 1a54b40c78
commit a06a9038a4

View file

@ -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)));
}
}
}
}