From 11cc2e6b3bd70717cbb919d072d633a2fb7d4bd3 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 22 Jul 2013 20:09:35 -0300 Subject: [PATCH] pad-monitor: fix expected setcaps fields comparison Use the correct structure when getting the GValues and print different messages for missing and different fields on the setcaps caps --- validate/gst/qa/gst-qa-pad-monitor.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/validate/gst/qa/gst-qa-pad-monitor.c b/validate/gst/qa/gst-qa-pad-monitor.c index a3e5b28..4a77eae 100644 --- a/validate/gst/qa/gst-qa-pad-monitor.c +++ b/validate/gst/qa/gst-qa-pad-monitor.c @@ -1247,15 +1247,27 @@ gst_qa_pad_monitor_setcaps_func (GstPad * pad, GstCaps * caps) structure = gst_caps_get_structure (caps, 0); if (gst_structure_n_fields (pad_monitor->pending_setcaps_fields)) { gint i; - for (i = 0; i < gst_structure_n_fields (structure); i++) { - const gchar *name = gst_structure_nth_field_name (structure, i); + for (i = 0; + i < gst_structure_n_fields (pad_monitor->pending_setcaps_fields); + i++) { + const gchar *name = + gst_structure_nth_field_name (pad_monitor->pending_setcaps_fields, + i); const GValue *v = gst_structure_get_value (structure, name); - const GValue *otherv = gst_structure_get_value (structure, name); + const GValue *otherv = + gst_structure_get_value (pad_monitor->pending_setcaps_fields, name); - if (!gst_value_compare (v, otherv) != GST_VALUE_EQUAL) { + if (v == NULL) { GST_QA_MONITOR_REPORT_WARNING (pad_monitor, FALSE, CAPS_NEGOTIATION, MISSING_FIELD, - "Field %s is missing from setcaps %" GST_PTR_FORMAT, name, caps); + "Field %s is missing from setcaps caps '%" GST_PTR_FORMAT "'", + name, caps); + } else if (gst_value_compare (v, otherv) != GST_VALUE_EQUAL) { + GST_QA_MONITOR_REPORT_WARNING (pad_monitor, FALSE, CAPS_NEGOTIATION, + MISSING_FIELD, + "Field %s from setcaps caps '%" GST_PTR_FORMAT "' is different " + "from expected value in caps '%" GST_PTR_FORMAT "'", name, caps, + pad_monitor->pending_setcaps_fields); } } } -- 2.7.4