From 04b98a4ecdd7d83caa537bdc883b6def11eb9195 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 19 Apr 2020 19:18:14 +0300 Subject: [PATCH] tsmux: Don't assert sinkpad reference counts in test We can't be sure about the reference count if the muxer is currently running, which can happen in the test_reappearing_pad test. An additional reference might temporarily be owned by the srcpad task of tsmux while iterating over the pads. --- tests/check/elements/mpegtsmux.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/tests/check/elements/mpegtsmux.c b/tests/check/elements/mpegtsmux.c index 3695434ce1..613dc59e62 100644 --- a/tests/check/elements/mpegtsmux.c +++ b/tests/check/elements/mpegtsmux.c @@ -69,21 +69,18 @@ setup_src_pad (GstElement * element, /* sending pad */ srcpad = gst_pad_new_from_static_template (template, "src"); fail_if (srcpad == NULL, "Could not create a srcpad"); - ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1); if (!(sinkpad = gst_element_get_static_pad (element, sinkname))) sinkpad = gst_element_get_request_pad (element, sinkname); fail_if (sinkpad == NULL, "Could not get sink pad from %s", GST_ELEMENT_NAME (element)); - /* references are owned by: 1) us, 2) tsmux */ - ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); + /* we can't test the reference count of the sinkpad here because it's either + * 2 or 3: 1 by us, 1 by tsmux and potentially another one by the srcpad + * task of tsmux if it just happens to iterate over the pads */ fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK, "Could not link source and %s sink pads", GST_ELEMENT_NAME (element)); gst_object_unref (sinkpad); /* because we got it higher up */ - /* references are owned by: 1) tsmux */ - ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1); - if (padname) *padname = g_strdup (GST_PAD_NAME (sinkpad)); @@ -98,21 +95,12 @@ teardown_src_pad (GstElement * element, const gchar * sinkname) /* clean up floating src pad */ if (!(sinkpad = gst_element_get_static_pad (element, sinkname))) sinkpad = gst_element_get_request_pad (element, sinkname); - /* pad refs held by 1) tsmux 2) us (through _get) */ - ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); srcpad = gst_pad_get_peer (sinkpad); gst_pad_unlink (srcpad, sinkpad); GST_DEBUG ("src %p", srcpad); - /* after unlinking, pad refs still held by - * 1) tsmux and 2) us (through _get) */ - ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); gst_object_unref (sinkpad); - /* one more ref is held by element itself */ - - /* pad refs held by both creator and this function (through _get_peer) */ - ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2); gst_object_unref (srcpad); gst_object_unref (srcpad); -- 2.34.1