check/gst/gstbin.c: Fix test case: we can't rely on a fixed state change order when going from READY => PAUSED becaus...

Original commit message from CVS:
* check/gst/gstbin.c: (test_children_state_change_order_flagged_sink),
(test_children_state_change_order_semi_sink):
Fix test case: we can't rely on a fixed state change order when
going from READY => PAUSED because the sink might commit its
new state first when the first buffer created by the source
reaches the sink before the source has finished its change state.
(Test case still fails at times, see #316856, comment 5 onwards)
This commit is contained in:
Tim-Philipp Müller 2005-09-24 14:35:07 +00:00
parent 84770e8437
commit 4ed6212a26
3 changed files with 46 additions and 0 deletions

View file

@ -1,3 +1,13 @@
2005-09-24 Tim-Philipp Müller <tim at centricular dot net>
* check/gst/gstbin.c: (test_children_state_change_order_flagged_sink),
(test_children_state_change_order_semi_sink):
Fix test case: we can't rely on a fixed state change order when
going from READY => PAUSED because the sink might commit its
new state first when the first buffer created by the source
reaches the sink before the source has finished its change state.
(Test case still fails at times, see #316856, comment 5 onwards)
2005-09-24 Wim Taymans <wim@fluendo.com> 2005-09-24 Wim Taymans <wim@fluendo.com>
* docs/design/part-events.txt: * docs/design/part-events.txt:

View file

@ -490,6 +490,11 @@ GST_START_TEST (test_children_state_change_order_flagged_sink)
* change and change state later when it has a buffer */ * change and change state later when it has a buffer */
ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED,
105); 105);
#if 0
/* From here on, all bets are off. Usually the source changes state next,
* but it might just as well be that the first buffer produced by the
* source reaches the sink before the source has finished its state change,
* in which case the sink will commit its new state before the source ... */
ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 106); ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 106);
ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 107); ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 107);
ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED,
@ -502,6 +507,10 @@ GST_START_TEST (test_children_state_change_order_flagged_sink)
ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 111); ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 111);
ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING,
112); 112);
#else
pop_messages (bus, 3); /* pop remaining ready => paused messages off the bus */
pop_messages (bus, 4); /* pop paused => playing messages off the bus */
#endif
/* don't set to NULL that will set the bus flushing and kill our messages */ /* don't set to NULL that will set the bus flushing and kill our messages */
ret = gst_element_set_state (pipeline, GST_STATE_READY); ret = gst_element_set_state (pipeline, GST_STATE_READY);
@ -572,6 +581,11 @@ GST_START_TEST (test_children_state_change_order_semi_sink)
* change and change state later when it has a buffer */ * change and change state later when it has a buffer */
ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED,
205); 205);
#if 0
/* From here on, all bets are off. Usually the source changes state next,
* but it might just as well be that the first buffer produced by the
* source reaches the sink before the source has finished its state change,
* in which case the sink will commit its new state before the source ... */
ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 206); ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 206);
ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 207); ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 207);
ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED,
@ -584,6 +598,10 @@ GST_START_TEST (test_children_state_change_order_semi_sink)
ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 211); ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 211);
ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING,
212); 212);
#else
pop_messages (bus, 3); /* pop remaining ready => paused messages off the bus */
pop_messages (bus, 4); /* pop paused => playing messages off the bus */
#endif
/* don't set to NULL that will set the bus flushing and kill our messages */ /* don't set to NULL that will set the bus flushing and kill our messages */
ret = gst_element_set_state (pipeline, GST_STATE_READY); ret = gst_element_set_state (pipeline, GST_STATE_READY);

View file

@ -490,6 +490,11 @@ GST_START_TEST (test_children_state_change_order_flagged_sink)
* change and change state later when it has a buffer */ * change and change state later when it has a buffer */
ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED,
105); 105);
#if 0
/* From here on, all bets are off. Usually the source changes state next,
* but it might just as well be that the first buffer produced by the
* source reaches the sink before the source has finished its state change,
* in which case the sink will commit its new state before the source ... */
ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 106); ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 106);
ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 107); ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 107);
ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED,
@ -502,6 +507,10 @@ GST_START_TEST (test_children_state_change_order_flagged_sink)
ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 111); ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 111);
ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING,
112); 112);
#else
pop_messages (bus, 3); /* pop remaining ready => paused messages off the bus */
pop_messages (bus, 4); /* pop paused => playing messages off the bus */
#endif
/* don't set to NULL that will set the bus flushing and kill our messages */ /* don't set to NULL that will set the bus flushing and kill our messages */
ret = gst_element_set_state (pipeline, GST_STATE_READY); ret = gst_element_set_state (pipeline, GST_STATE_READY);
@ -572,6 +581,11 @@ GST_START_TEST (test_children_state_change_order_semi_sink)
* change and change state later when it has a buffer */ * change and change state later when it has a buffer */
ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED,
205); 205);
#if 0
/* From here on, all bets are off. Usually the source changes state next,
* but it might just as well be that the first buffer produced by the
* source reaches the sink before the source has finished its state change,
* in which case the sink will commit its new state before the source ... */
ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 206); ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 206);
ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 207); ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 207);
ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED,
@ -584,6 +598,10 @@ GST_START_TEST (test_children_state_change_order_semi_sink)
ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 211); ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 211);
ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING,
212); 212);
#else
pop_messages (bus, 3); /* pop remaining ready => paused messages off the bus */
pop_messages (bus, 4); /* pop paused => playing messages off the bus */
#endif
/* don't set to NULL that will set the bus flushing and kill our messages */ /* don't set to NULL that will set the bus flushing and kill our messages */
ret = gst_element_set_state (pipeline, GST_STATE_READY); ret = gst_element_set_state (pipeline, GST_STATE_READY);