From 4ed6212a26c674aa297c5e024aad8d6920132d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 24 Sep 2005 14:35:07 +0000 Subject: [PATCH] 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) --- ChangeLog | 10 ++++++++++ check/gst/gstbin.c | 18 ++++++++++++++++++ tests/check/gst/gstbin.c | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index 13a89e12ea..79533bc45e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-09-24 Tim-Philipp Müller + + * 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 * docs/design/part-events.txt: diff --git a/check/gst/gstbin.c b/check/gst/gstbin.c index f205bb025a..f3faf2a898 100644 --- a/check/gst/gstbin.c +++ b/check/gst/gstbin.c @@ -490,6 +490,11 @@ GST_START_TEST (test_children_state_change_order_flagged_sink) * change and change state later when it has a buffer */ ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, 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, sink, GST_STATE_READY, GST_STATE_PAUSED, 107); 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, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, 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 */ 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 */ ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, 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, sink, GST_STATE_READY, GST_STATE_PAUSED, 207); 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, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, 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 */ ret = gst_element_set_state (pipeline, GST_STATE_READY); diff --git a/tests/check/gst/gstbin.c b/tests/check/gst/gstbin.c index f205bb025a..f3faf2a898 100644 --- a/tests/check/gst/gstbin.c +++ b/tests/check/gst/gstbin.c @@ -490,6 +490,11 @@ GST_START_TEST (test_children_state_change_order_flagged_sink) * change and change state later when it has a buffer */ ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, 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, sink, GST_STATE_READY, GST_STATE_PAUSED, 107); 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, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, 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 */ 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 */ ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, 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, sink, GST_STATE_READY, GST_STATE_PAUSED, 207); 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, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, 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 */ ret = gst_element_set_state (pipeline, GST_STATE_READY);