qa-report: Do not keep a ref to the source but keep its name instead

We currently do not need to access the object source after its creation
but we need to be able to have a usefull for debugging name.
This commit is contained in:
Thibault Saunier 2013-07-18 10:59:11 -04:00 committed by Thiago Santos
parent 7faac43afb
commit 4b808aeb81
2 changed files with 8 additions and 4 deletions

View file

@ -154,7 +154,11 @@ gst_qa_report_new (GstObject * source, GstQaReportLevel level,
report->level = level;
report->area = area;
report->subarea = subarea;
report->source = g_object_ref (source);
if (GST_IS_PAD (source))
report->source_name =
g_strdup_printf ("%s:%s", GST_DEBUG_PAD_NAME (source));
else
report->source_name = g_strdup (GST_OBJECT_NAME (source));
report->message = g_strdup (message);
report->timestamp = gst_util_get_timestamp () - _gst_qa_report_start_time;
@ -166,7 +170,7 @@ gst_qa_report_unref (GstQaReport * report)
{
if (G_UNLIKELY (g_atomic_int_dec_and_test (&report->refcount))) {
g_free (report->message);
g_object_unref (report->source);
g_free (report->source_name);
g_slice_free (GstQaReport, report);
}
}

View file

@ -83,14 +83,14 @@ typedef struct {
gint subarea;
gchar *message;
GstObject *source;
gchar *source_name;
guint64 timestamp;
} GstQaReport;
#define GST_QA_ERROR_REPORT_PRINT_FORMAT GST_TIME_FORMAT " (%s): %s, %s(%d)) %s(%d): %s"
#define GST_QA_REPORT_PRINT_ARGS(r) GST_TIME_ARGS (r->timestamp), \
gst_qa_report_level_get_name (r->level), \
r->source ? GST_OBJECT_NAME(r->source) : "null", \
r->source_name, \
gst_qa_report_area_get_name(r->area), r->area, \
gst_qa_report_subarea_get_name(r->area, r->subarea), r->subarea, \
r->message