tee: Check for the removed pad flag also in the slow pushing path
[platform/upstream/gstreamer.git] / gst / gsttracerrecord.c
index 9a99e23..639a4cc 100644 (file)
@@ -21,6 +21,7 @@
 
 /**
  * SECTION:gsttracerrecord
+ * @title: GstTracerRecord
  * @short_description: Trace log entry class
  *
  * Tracing modules will create instances of this class to announce the data they
@@ -112,6 +113,7 @@ gst_tracer_record_build_format (GstTracerRecord * self)
   /* cut off '.class' suffix */
   name = g_strdup (name);
   p = strrchr (name, '.');
+  g_assert (p != NULL);
   *p = '\0';
 
   s = g_string_sized_new (STRUCTURE_ESTIMATED_STRING_LEN (structure));
@@ -174,11 +176,9 @@ gst_tracer_record_init (GstTracerRecord * self)
  * pointer type values must not be NULL - the underlying serialisation can not
  * handle that right now.
  *
- * <note><para>
- *   Please note that this is still under discussion and subject to change.
- * </para></note>
+ * > Please note that this is still under discussion and subject to change.
  *
- * Returns: a new #GstTracerRecord
+ * Returns: (transfer full): a new #GstTracerRecord
  */
 GstTracerRecord *
 gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
@@ -186,41 +186,44 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
   GstTracerRecord *self;
   GstStructure *structure;
   va_list varargs;
+  gchar *err = NULL;
+  GType type;
+  GQuark id;
 
   va_start (varargs, firstfield);
   structure = gst_structure_new_empty (name);
-  if (structure) {
-    gchar *err = NULL;
-    GType type;
-    GQuark id;
-
-    while (firstfield) {
-      GValue val = { 0, };
-
-      id = g_quark_from_string (firstfield);
-      type = va_arg (varargs, GType);
-
-      /* 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",
-            firstfield, g_type_name (type));
-      }
-
-      G_VALUE_COLLECT_INIT (&val, type, varargs, G_VALUE_NOCOPY_CONTENTS, &err);
-      if (G_UNLIKELY (err)) {
-        g_critical ("%s", err);
-        break;
-      }
-      /* see boxed_proxy_collect_value */
-      val.data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
-      gst_structure_id_take_value (structure, id, &val);
-
-      firstfield = va_arg (varargs, gchar *);
+
+  while (firstfield) {
+    GValue val = { 0, };
+
+    id = g_quark_from_string (firstfield);
+    type = va_arg (varargs, GType);
+
+    /* 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",
+          firstfield, g_type_name (type));
+    }
+
+    G_VALUE_COLLECT_INIT (&val, type, varargs, G_VALUE_NOCOPY_CONTENTS, &err);
+    if (G_UNLIKELY (err)) {
+      g_critical ("%s", err);
+      g_free (err);
+      break;
     }
+    /* see boxed_proxy_collect_value */
+    val.data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
+    gst_structure_id_take_value (structure, id, &val);
+
+    firstfield = va_arg (varargs, gchar *);
   }
   va_end (varargs);
 
-  self = g_object_newv (GST_TYPE_TRACER_RECORD, 0, NULL);
+  self = g_object_new (GST_TYPE_TRACER_RECORD, NULL);
+
+  /* Clear floating flag */
+  gst_object_ref_sink (self);
+
   self->spec = structure;
   gst_tracer_record_build_format (self);
 
@@ -237,9 +240,8 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
  *
  * Right now this is using the gstreamer debug log with the level TRACE (7) and
  * the category "GST_TRACER".
- * <note><para>
- *   Please note that this is still under discussion and subject to change.
- * </para></note>
+ *
+ * > Please note that this is still under discussion and subject to change.
  */
 void
 gst_tracer_record_log (GstTracerRecord * self, ...)