diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-06-21 10:43:18 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2019-07-01 13:33:13 +0000 |
commit | aae5f58dd128c3730bf7865fed446979c678758a (patch) | |
tree | 7258c84c760fb2bf4ff12984c564c559a5ba077c /gst/gsttracerrecord.c | |
parent | bafa7a5ca7604aa3302981a776ee7d953e6dc96c (diff) |
tracerrecord: Be stricter while parsing record templates
It's not really possible for us to recover when someone uses the
gst_tracer_record_new() API incorrectly. Also, document a piece of
somewhat-obscure code.
Diffstat (limited to 'gst/gsttracerrecord.c')
-rw-r--r-- | gst/gsttracerrecord.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gst/gsttracerrecord.c b/gst/gsttracerrecord.c index 639a4ccbb3..a2cc11ef0c 100644 --- a/gst/gsttracerrecord.c +++ b/gst/gsttracerrecord.c @@ -70,7 +70,7 @@ build_field_template (GQuark field_id, const GValue * value, gpointer user_data) gboolean res; if (G_VALUE_TYPE (value) != GST_TYPE_STRUCTURE) { - GST_WARNING ("expected field of type GstStructure, but %s is %s", + GST_ERROR ("expected field of type GstStructure, but %s is %s", g_quark_to_string (field_id), G_VALUE_TYPE_NAME (value)); return FALSE; } @@ -201,8 +201,11 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...) /* all fields passed here must be GstStructures which we take over */ if (type != GST_TYPE_STRUCTURE) { - GST_WARNING ("expected field of type GstStructure, but %s is %s", + GST_ERROR ("expected field of type GstStructure, but %s is %s", firstfield, g_type_name (type)); + va_end (varargs); + gst_structure_free (structure); + return NULL; } G_VALUE_COLLECT_INIT (&val, type, varargs, G_VALUE_NOCOPY_CONTENTS, &err); @@ -211,7 +214,9 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...) g_free (err); break; } - /* see boxed_proxy_collect_value */ + /* give ownership of the GstStructure "value" collected from varargs + * to this structure by unsetting the NOCOPY_CONTENTS collect-flag. + * see boxed_proxy_collect_value in glib's gobject/gboxed.c */ val.data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS; gst_structure_id_take_value (structure, id, &val); |