mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-19 20:46:22 +00:00
tests: Test reports refcounts.
+ Set the element monitor on the element as qdata.
This commit is contained in:
parent
c943a75766
commit
de554ba417
4 changed files with 43 additions and 0 deletions
|
@ -161,6 +161,14 @@ gst_validate_element_monitor_do_setup (GstValidateMonitor * monitor)
|
|||
GST_VALIDATE_MONITOR_GET_OBJECT (monitor));
|
||||
element = GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor);
|
||||
|
||||
if (g_object_get_data ((GObject *) element, "validate-monitor")) {
|
||||
GST_WARNING_OBJECT (elem_monitor,
|
||||
"Pad already has a validate-monitor associated");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_object_set_data ((GObject *) element, "validate-monitor", elem_monitor);
|
||||
|
||||
gst_validate_element_monitor_inspect (elem_monitor);
|
||||
|
||||
elem_monitor->pad_added_id = g_signal_connect (element, "pad-added",
|
||||
|
|
|
@ -22,6 +22,22 @@
|
|||
#include <gst/check/gstcheck.h>
|
||||
#include "test-utils.h"
|
||||
|
||||
static void
|
||||
_check_reports_refcount (GstPad *pad, gint refcount)
|
||||
{
|
||||
GList *tmp, *reports;
|
||||
GstValidateReporter *reporter = (GstValidateReporter *) g_object_get_data (G_OBJECT (pad), "validate-monitor");
|
||||
|
||||
reports = gst_validate_reporter_get_reports (reporter);
|
||||
/* We take a ref here */
|
||||
refcount += 1;
|
||||
|
||||
for (tmp = reports; tmp; tmp = tmp->next)
|
||||
fail_unless_equals_int (((GstValidateReport *) tmp->data)->refcount, refcount);
|
||||
|
||||
g_list_free_full (reports, (GDestroyNotify )gst_validate_report_unref);
|
||||
}
|
||||
|
||||
GST_START_TEST (buffer_before_segment)
|
||||
{
|
||||
GstPad *srcpad;
|
||||
|
@ -81,6 +97,7 @@ GST_START_TEST (buffer_before_segment)
|
|||
fail_unless_equals_int (gst_element_set_state (sink, GST_STATE_NULL),
|
||||
GST_STATE_CHANGE_SUCCESS);
|
||||
|
||||
_check_reports_refcount (srcpad, 2);
|
||||
gst_object_unref (srcpad);
|
||||
check_destroyed (src, srcpad, NULL);
|
||||
check_destroyed (sink, NULL, NULL);
|
||||
|
@ -504,6 +521,14 @@ GST_START_TEST (issue_concatenation)
|
|||
gst_pad_remove_probe (srcpad1, probe_id1);
|
||||
gst_pad_remove_probe (srcpad2, probe_id2);
|
||||
|
||||
/* The reporter, the runner */
|
||||
_check_reports_refcount (srcpad1, 2);
|
||||
/* The reporter, the master report */
|
||||
_check_reports_refcount (funnel_sink1, 2);
|
||||
free_element_monitor (src1);
|
||||
free_element_monitor (src2);
|
||||
free_element_monitor (funnel);
|
||||
free_element_monitor (sink);
|
||||
gst_object_unref (srcpad1);
|
||||
gst_object_unref (srcpad2);
|
||||
gst_object_unref (sinkpad);
|
||||
|
|
|
@ -213,3 +213,12 @@ GstElement * create_and_monitor_element (const gchar *factoryname, const gchar *
|
|||
|
||||
return element;
|
||||
}
|
||||
|
||||
void
|
||||
free_element_monitor (GstElement *element)
|
||||
{
|
||||
GstValidateMonitor *monitor;
|
||||
monitor = (GstValidateMonitor *) g_object_get_data (G_OBJECT (element), "validate-monitor");
|
||||
|
||||
g_object_unref (G_OBJECT(monitor));
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ GstValidateRunner * setup_runner (GstObject * object);
|
|||
void clean_bus (GstElement *element);
|
||||
GstValidatePadMonitor * get_pad_monitor (GstPad *pad);
|
||||
GstElement * create_and_monitor_element (const gchar *factoryname, const gchar *name, GstValidateRunner *runner);
|
||||
void free_element_monitor (GstElement *element);
|
||||
|
||||
typedef struct {
|
||||
GstElement parent;
|
||||
|
|
Loading…
Reference in a new issue