check/Makefile.am: clean up environment for when registry gets built versus when actual tests are run; valgrind seems...

Original commit message from CVS:

* check/Makefile.am:
clean up environment for when registry gets built versus
when actual tests are run; valgrind seems to not report
leaks if GST_PLUGIN_PATH is set to some specific values
* check/gst/gstbin.c: (GST_START_TEST):
add more refcounting checks; maybe this exposes a
preroll lock bug ?
* common/check.mak:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object):
* gst/check/gstcheck.h:
* gst/gstbin.c: (bin_element_is_semi_sink), (gst_bin_get_state),
(gst_bin_change_state):
* gst/gstpad.c: (gst_pad_activate_push), (gst_pad_chain):
add/fix debugging/whitespace
This commit is contained in:
Thomas Vander Stichele 2005-08-21 15:01:18 +00:00
parent 080b848ffb
commit e5afa8a31b
12 changed files with 188 additions and 60 deletions

View file

@ -1,3 +1,20 @@
2005-08-21 Thomas Vander Stichele <thomas at apestaart dot org>
* check/Makefile.am:
clean up environment for when registry gets built versus
when actual tests are run; valgrind seems to not report
leaks if GST_PLUGIN_PATH is set to some specific values
* check/gst/gstbin.c: (GST_START_TEST):
add more refcounting checks; maybe this exposes a
preroll lock bug ?
* common/check.mak:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object):
* gst/check/gstcheck.h:
* gst/gstbin.c: (bin_element_is_semi_sink), (gst_bin_get_state),
(gst_bin_change_state):
* gst/gstpad.c: (gst_pad_activate_push), (gst_pad_chain):
add/fix debugging/whitespace
2005-08-21 Jan Schmidt <thaytan@mad.scientist.com> 2005-08-21 Jan Schmidt <thaytan@mad.scientist.com>
* check/gst/gstevent.c: (event_probe), (test_event), * check/gst/gstevent.c: (event_probe), (test_event),

View file

@ -4,9 +4,14 @@ CHECK_REGISTRY = $(top_builddir)/check/test-registry.xml
GST_TOOLS_DIR = $(top_builddir)/tools GST_TOOLS_DIR = $(top_builddir)/tools
TESTS_ENVIRONMENT=\ REGISTRY_ENVIRONMENT = \
GST_REGISTRY=$(CHECK_REGISTRY) GST_REGISTRY=$(CHECK_REGISTRY)
TESTS_ENVIRONMENT = \
$(REGISTRY_ENVIRONMENT) \
GST_PLUGIN_PATH_ONLY=yes \
GST_PLUGIN_PATH=$(top_builddir)/gst
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
# rebuild gst-register-@GST_MAJORMINOR@ if needed # rebuild gst-register-@GST_MAJORMINOR@ if needed
@ -25,13 +30,9 @@ clean-local: clean-local-check
$(CHECK_REGISTRY): $(CHECK_REGISTRY):
$(TESTS_ENVIRONMENT) \ $(TESTS_ENVIRONMENT) \
GST_PLUGIN_PATH_ONLY=yes \ $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@
GST_PLUGIN_PATH=$(top_builddir)/gst \
$(top_builddir)/tools/gst-register
# FIXME: it'd be nicer to run the versioned register, but in that case check_PROGRAMS = \
# "make dist" complains about not finding gst-register-0.9.c
TESTS = $(top_builddir)/tools/gst-register \
gst/gst \ gst/gst \
gst/gstbin \ gst/gstbin \
gst/gstbuffer \ gst/gstbuffer \
@ -57,7 +58,8 @@ TESTS = $(top_builddir)/tools/gst-register \
gst-libs/controller \ gst-libs/controller \
gst-libs/gdp gst-libs/gdp
check_PROGRAMS = $(TESTS) TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
$(check_PROGRAMS)
noinst_HEADERS = gst/capslist.h noinst_HEADERS = gst/capslist.h
@ -89,7 +91,7 @@ TESTS_THREADED = \
gst/gstminiobject \ gst/gstminiobject \
gst/gstobject gst/gstobject
VALGRIND_TESTS_DISABLE = \ VALGRIND_TESTS_DISABLE = \
$(top_builddir)/tools/gst-register \ $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
$(TESTS_THREADED) \ $(TESTS_THREADED) \
$(TESTS_TO_FIX) $(TESTS_TO_FIX)

View file

@ -221,26 +221,72 @@ GST_START_TEST (test_message_state_changed_children)
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (src, "sink", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);
bus = GST_ELEMENT_BUS (pipeline); bus = GST_ELEMENT_BUS (pipeline);
/* change state, spawning three times three messages */ /* change state to READY, spawning three messages */
GST_DEBUG ("setting pipeline to PLAYING"); GST_DEBUG ("setting pipeline to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING) fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY)
== GST_STATE_SUCCESS); == GST_STATE_SUCCESS);
pop_messages (bus, 9); /* each object is referenced by a message */
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 2);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 2);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2);
pop_messages (bus, 3);
fail_if ((gst_bus_pop (bus)) != NULL);
/* this test is completely bogus as the refcount can change while running */
#if 0
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1); ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
#endif
/* change state to PAUSED, spawning three messages */
GST_DEBUG ("setting pipeline to PAUSED");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED)
== GST_STATE_SUCCESS);
/* each object is referenced by a message;
* base_sink_chain has taken a refcount on the sink, and is blocked on
* preroll */
ASSERT_OBJECT_REFCOUNT (src, "src", 2);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 3);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2);
pop_messages (bus, 3);
fail_if ((gst_bus_pop (bus)) != NULL);
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 2);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
/* change state to PLAYING, spawning three messages */
GST_DEBUG ("setting pipeline to PLAYING");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING)
== GST_STATE_SUCCESS);
/* each object is referenced by one message; sink still has an extra
* because it's still blocked on preroll */
ASSERT_OBJECT_REFCOUNT (src, "src", 2);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 3);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2);
pop_messages (bus, 3);
fail_if ((gst_bus_pop (bus)) != NULL);
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 2);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
/* go back to READY, spawning six messages */ /* go back to READY, spawning six messages */
/* FIXME: only now does the sink get unblocked from preroll
* (check log for "done preroll")
* mabe that's a bug ? */
GST_DEBUG ("setting pipeline to READY"); GST_DEBUG ("setting pipeline to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY) fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY)
== GST_STATE_SUCCESS); == GST_STATE_SUCCESS);
@ -251,6 +297,7 @@ GST_START_TEST (test_message_state_changed_children)
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3); ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3);
pop_messages (bus, 6); pop_messages (bus, 6);
fail_if ((gst_bus_pop (bus)) != NULL);
ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);

2
common

@ -1 +1 @@
Subproject commit 609c7716bab17e1dc086d3b54b51740300ec6f0f Subproject commit aa2a757c587d91069a230d8e656481c3c364ccc6

View file

@ -473,7 +473,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
GST_PREROLL_LOCK (pad); GST_PREROLL_LOCK (pad);
/* push object on the queue */ /* push object on the queue */
GST_DEBUG ("push on queue %p", basesink, obj); GST_DEBUG_OBJECT (basesink, "push %p on preroll_queue", obj);
g_queue_push_tail (basesink->preroll_queue, obj); g_queue_push_tail (basesink->preroll_queue, obj);
have_event = GST_IS_EVENT (obj); have_event = GST_IS_EVENT (obj);
@ -572,7 +572,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
/* now we commit our state */ /* now we commit our state */
GST_STATE_LOCK (basesink); GST_STATE_LOCK (basesink);
GST_DEBUG ("commit state %p >", basesink); GST_DEBUG_OBJECT (basesink, "commit state");
gst_element_commit_state (GST_ELEMENT (basesink)); gst_element_commit_state (GST_ELEMENT (basesink));
GST_STATE_UNLOCK (basesink); GST_STATE_UNLOCK (basesink);
@ -604,10 +604,10 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
* application thread and we don't want to block there. */ * application thread and we don't want to block there. */
if (length > basesink->preroll_queue_max_len && !have_event) { if (length > basesink->preroll_queue_max_len && !have_event) {
/* block until the state changes, or we get a flush, or something */ /* block until the state changes, or we get a flush, or something */
GST_DEBUG ("element %s waiting to finish preroll", GST_DEBUG_OBJECT (basesink, "waiting to finish preroll",
GST_ELEMENT_NAME (basesink)); GST_ELEMENT_NAME (basesink));
GST_PREROLL_WAIT (pad); GST_PREROLL_WAIT (pad);
GST_DEBUG ("done preroll"); GST_DEBUG_OBJECT (basesink, "done preroll");
} }
GST_LOCK (pad); GST_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
@ -651,7 +651,7 @@ playing_async:
g_warning ("STREAM_LOCK should have been locked !!"); g_warning ("STREAM_LOCK should have been locked !!");
} }
GST_STATE_LOCK (basesink); GST_STATE_LOCK (basesink);
GST_DEBUG ("commit state %p >", basesink); GST_DEBUG_OBJECT (basesink, "commit state");
gst_element_commit_state (GST_ELEMENT (basesink)); gst_element_commit_state (GST_ELEMENT (basesink));
GST_STATE_UNLOCK (basesink); GST_STATE_UNLOCK (basesink);
if (t > 0) if (t > 0)
@ -686,7 +686,7 @@ preroll_failed:
/* now we abort our state */ /* now we abort our state */
GST_STATE_LOCK (basesink); GST_STATE_LOCK (basesink);
GST_DEBUG ("abort state %p >", basesink); GST_DEBUG_OBJECT (basesink, "abort state");
gst_element_abort_state (GST_ELEMENT (basesink)); gst_element_abort_state (GST_ELEMENT (basesink));
GST_STATE_UNLOCK (basesink); GST_STATE_UNLOCK (basesink);

View file

@ -203,7 +203,8 @@ G_STMT_START { \
int rc; \ int rc; \
rc = GST_OBJECT_REFCOUNT_VALUE (object); \ rc = GST_OBJECT_REFCOUNT_VALUE (object); \
fail_unless (rc == value, \ fail_unless (rc == value, \
"%s refcount is %d instead of %d", name, rc, value); \ "%s (%p) refcount is %d instead of %d", \
name, object, rc, value); \
} G_STMT_END } G_STMT_END
#define ASSERT_CAPS_REFCOUNT(caps, name, value) \ #define ASSERT_CAPS_REFCOUNT(caps, name, value) \

View file

@ -778,6 +778,7 @@ bin_element_is_semi_sink (GstElement * child, GstBin * bin)
for (pads = child->srcpads; pads; pads = g_list_next (pads)) { for (pads = child->srcpads; pads; pads = g_list_next (pads)) {
GstPad *peer; GstPad *peer;
GST_DEBUG ("looking at pad %p", pads->data);
if ((peer = gst_pad_get_peer (GST_PAD_CAST (pads->data)))) { if ((peer = gst_pad_get_peer (GST_PAD_CAST (pads->data)))) {
connected_src = connected_src =
has_ancestor (GST_OBJECT_CAST (peer), GST_OBJECT_CAST (bin)); has_ancestor (GST_OBJECT_CAST (peer), GST_OBJECT_CAST (bin));
@ -1160,6 +1161,7 @@ restart:
children = bin->children; children = bin->children;
children_cookie = bin->children_cookie; children_cookie = bin->children_cookie;
GST_DEBUG_OBJECT (bin, "reffing and examining children");
while (children) { while (children) {
GstElement *child = GST_ELEMENT_CAST (children->data); GstElement *child = GST_ELEMENT_CAST (children->data);
@ -1183,7 +1185,9 @@ restart:
} }
children = g_list_next (children); children = g_list_next (children);
} }
GST_DEBUG_OBJECT (bin, "reffed and examined children");
GST_UNLOCK (bin); GST_UNLOCK (bin);
/* after this point new elements can be added/removed from the /* after this point new elements can be added/removed from the
* bin. We operate on the snapshot taken above. Applications * bin. We operate on the snapshot taken above. Applications
* should serialize their add/remove and set_state. */ * should serialize their add/remove and set_state. */
@ -1203,6 +1207,7 @@ restart:
} }
/* second step, change state of elements in the queue */ /* second step, change state of elements in the queue */
GST_DEBUG_OBJECT (bin, "change state of elements in the queue");
while (!g_queue_is_empty (elem_queue)) { while (!g_queue_is_empty (elem_queue)) {
GstElement *qelement; GstElement *qelement;
GList *pads; GList *pads;

View file

@ -634,6 +634,8 @@ gst_pad_activate_push (GstPad * pad, gboolean active)
GstActivateMode old; GstActivateMode old;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE); g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "trying to set %s in push mode",
active ? "activated" : "deactivated");
GST_LOCK (pad); GST_LOCK (pad);
old = GST_PAD_ACTIVATE_MODE (pad); old = GST_PAD_ACTIVATE_MODE (pad);
@ -2942,6 +2944,10 @@ gst_pad_chain (GstPad * pad, GstBuffer * buffer)
ret = chainfunc (pad, buffer); ret = chainfunc (pad, buffer);
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"called chainfunction &%s of pad %s:%s, returned %d",
GST_DEBUG_FUNCPTR_NAME (chainfunc), GST_DEBUG_PAD_NAME (pad), ret);
GST_STREAM_UNLOCK (pad); GST_STREAM_UNLOCK (pad);
return ret; return ret;

View file

@ -473,7 +473,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
GST_PREROLL_LOCK (pad); GST_PREROLL_LOCK (pad);
/* push object on the queue */ /* push object on the queue */
GST_DEBUG ("push on queue %p", basesink, obj); GST_DEBUG_OBJECT (basesink, "push %p on preroll_queue", obj);
g_queue_push_tail (basesink->preroll_queue, obj); g_queue_push_tail (basesink->preroll_queue, obj);
have_event = GST_IS_EVENT (obj); have_event = GST_IS_EVENT (obj);
@ -572,7 +572,7 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
/* now we commit our state */ /* now we commit our state */
GST_STATE_LOCK (basesink); GST_STATE_LOCK (basesink);
GST_DEBUG ("commit state %p >", basesink); GST_DEBUG_OBJECT (basesink, "commit state");
gst_element_commit_state (GST_ELEMENT (basesink)); gst_element_commit_state (GST_ELEMENT (basesink));
GST_STATE_UNLOCK (basesink); GST_STATE_UNLOCK (basesink);
@ -604,10 +604,10 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
* application thread and we don't want to block there. */ * application thread and we don't want to block there. */
if (length > basesink->preroll_queue_max_len && !have_event) { if (length > basesink->preroll_queue_max_len && !have_event) {
/* block until the state changes, or we get a flush, or something */ /* block until the state changes, or we get a flush, or something */
GST_DEBUG ("element %s waiting to finish preroll", GST_DEBUG_OBJECT (basesink, "waiting to finish preroll",
GST_ELEMENT_NAME (basesink)); GST_ELEMENT_NAME (basesink));
GST_PREROLL_WAIT (pad); GST_PREROLL_WAIT (pad);
GST_DEBUG ("done preroll"); GST_DEBUG_OBJECT (basesink, "done preroll");
} }
GST_LOCK (pad); GST_LOCK (pad);
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad))) if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
@ -651,7 +651,7 @@ playing_async:
g_warning ("STREAM_LOCK should have been locked !!"); g_warning ("STREAM_LOCK should have been locked !!");
} }
GST_STATE_LOCK (basesink); GST_STATE_LOCK (basesink);
GST_DEBUG ("commit state %p >", basesink); GST_DEBUG_OBJECT (basesink, "commit state");
gst_element_commit_state (GST_ELEMENT (basesink)); gst_element_commit_state (GST_ELEMENT (basesink));
GST_STATE_UNLOCK (basesink); GST_STATE_UNLOCK (basesink);
if (t > 0) if (t > 0)
@ -686,7 +686,7 @@ preroll_failed:
/* now we abort our state */ /* now we abort our state */
GST_STATE_LOCK (basesink); GST_STATE_LOCK (basesink);
GST_DEBUG ("abort state %p >", basesink); GST_DEBUG_OBJECT (basesink, "abort state");
gst_element_abort_state (GST_ELEMENT (basesink)); gst_element_abort_state (GST_ELEMENT (basesink));
GST_STATE_UNLOCK (basesink); GST_STATE_UNLOCK (basesink);

View file

@ -203,7 +203,8 @@ G_STMT_START { \
int rc; \ int rc; \
rc = GST_OBJECT_REFCOUNT_VALUE (object); \ rc = GST_OBJECT_REFCOUNT_VALUE (object); \
fail_unless (rc == value, \ fail_unless (rc == value, \
"%s refcount is %d instead of %d", name, rc, value); \ "%s (%p) refcount is %d instead of %d", \
name, object, rc, value); \
} G_STMT_END } G_STMT_END
#define ASSERT_CAPS_REFCOUNT(caps, name, value) \ #define ASSERT_CAPS_REFCOUNT(caps, name, value) \

View file

@ -4,9 +4,14 @@ CHECK_REGISTRY = $(top_builddir)/check/test-registry.xml
GST_TOOLS_DIR = $(top_builddir)/tools GST_TOOLS_DIR = $(top_builddir)/tools
TESTS_ENVIRONMENT=\ REGISTRY_ENVIRONMENT = \
GST_REGISTRY=$(CHECK_REGISTRY) GST_REGISTRY=$(CHECK_REGISTRY)
TESTS_ENVIRONMENT = \
$(REGISTRY_ENVIRONMENT) \
GST_PLUGIN_PATH_ONLY=yes \
GST_PLUGIN_PATH=$(top_builddir)/gst
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
# rebuild gst-register-@GST_MAJORMINOR@ if needed # rebuild gst-register-@GST_MAJORMINOR@ if needed
@ -25,13 +30,9 @@ clean-local: clean-local-check
$(CHECK_REGISTRY): $(CHECK_REGISTRY):
$(TESTS_ENVIRONMENT) \ $(TESTS_ENVIRONMENT) \
GST_PLUGIN_PATH_ONLY=yes \ $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@
GST_PLUGIN_PATH=$(top_builddir)/gst \
$(top_builddir)/tools/gst-register
# FIXME: it'd be nicer to run the versioned register, but in that case check_PROGRAMS = \
# "make dist" complains about not finding gst-register-0.9.c
TESTS = $(top_builddir)/tools/gst-register \
gst/gst \ gst/gst \
gst/gstbin \ gst/gstbin \
gst/gstbuffer \ gst/gstbuffer \
@ -57,7 +58,8 @@ TESTS = $(top_builddir)/tools/gst-register \
gst-libs/controller \ gst-libs/controller \
gst-libs/gdp gst-libs/gdp
check_PROGRAMS = $(TESTS) TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
$(check_PROGRAMS)
noinst_HEADERS = gst/capslist.h noinst_HEADERS = gst/capslist.h
@ -89,7 +91,7 @@ TESTS_THREADED = \
gst/gstminiobject \ gst/gstminiobject \
gst/gstobject gst/gstobject
VALGRIND_TESTS_DISABLE = \ VALGRIND_TESTS_DISABLE = \
$(top_builddir)/tools/gst-register \ $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
$(TESTS_THREADED) \ $(TESTS_THREADED) \
$(TESTS_TO_FIX) $(TESTS_TO_FIX)

View file

@ -221,26 +221,72 @@ GST_START_TEST (test_message_state_changed_children)
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (src, "sink", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);
bus = GST_ELEMENT_BUS (pipeline); bus = GST_ELEMENT_BUS (pipeline);
/* change state, spawning three times three messages */ /* change state to READY, spawning three messages */
GST_DEBUG ("setting pipeline to PLAYING"); GST_DEBUG ("setting pipeline to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING) fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY)
== GST_STATE_SUCCESS); == GST_STATE_SUCCESS);
pop_messages (bus, 9); /* each object is referenced by a message */
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 2);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 2);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2);
pop_messages (bus, 3);
fail_if ((gst_bus_pop (bus)) != NULL);
/* this test is completely bogus as the refcount can change while running */
#if 0
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1); ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
#endif
/* change state to PAUSED, spawning three messages */
GST_DEBUG ("setting pipeline to PAUSED");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED)
== GST_STATE_SUCCESS);
/* each object is referenced by a message;
* base_sink_chain has taken a refcount on the sink, and is blocked on
* preroll */
ASSERT_OBJECT_REFCOUNT (src, "src", 2);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 3);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2);
pop_messages (bus, 3);
fail_if ((gst_bus_pop (bus)) != NULL);
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 2);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
/* change state to PLAYING, spawning three messages */
GST_DEBUG ("setting pipeline to PLAYING");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING)
== GST_STATE_SUCCESS);
/* each object is referenced by one message; sink still has an extra
* because it's still blocked on preroll */
ASSERT_OBJECT_REFCOUNT (src, "src", 2);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 3);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2);
pop_messages (bus, 3);
fail_if ((gst_bus_pop (bus)) != NULL);
ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 2);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
/* go back to READY, spawning six messages */ /* go back to READY, spawning six messages */
/* FIXME: only now does the sink get unblocked from preroll
* (check log for "done preroll")
* mabe that's a bug ? */
GST_DEBUG ("setting pipeline to READY"); GST_DEBUG ("setting pipeline to READY");
fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY) fail_unless (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY)
== GST_STATE_SUCCESS); == GST_STATE_SUCCESS);
@ -251,6 +297,7 @@ GST_START_TEST (test_message_state_changed_children)
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3); ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3);
pop_messages (bus, 6); pop_messages (bus, 6);
fail_if ((gst_bus_pop (bus)) != NULL);
ASSERT_OBJECT_REFCOUNT (src, "src", 1); ASSERT_OBJECT_REFCOUNT (src, "src", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);