check/gst/gstbin.c: Fix test case: we can't rely on a fixed state change order when...
authorTim-Philipp Müller <tim@centricular.net>
Sat, 24 Sep 2005 14:35:07 +0000 (14:35 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Sat, 24 Sep 2005 14:35:07 +0000 (14:35 +0000)
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
check/gst/gstbin.c
tests/check/gst/gstbin.c

index 13a89e1..79533bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * docs/design/part-events.txt:
index f205bb0..f3faf2a 100644 (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 */
   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);
index f205bb0..f3faf2a 100644 (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 */
   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);