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
This commit is contained in:
Thiago Santos 2013-07-22 20:09:35 -03:00
parent 363de0e555
commit 11cc2e6b3b

View file

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