streamsynchronizer: Should wait state change complete before start another state...
authorSong Bing <b06498@freescale.com>
Tue, 3 Mar 2015 07:18:04 +0000 (15:18 +0800)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 11 Mar 2015 15:51:02 +0000 (15:51 +0000)
Should wait state change complete before start another state change.
Can't ensure can received async-done message when state change from PLAYING to PAUSED.

https://bugzilla.gnome.org/show_bug.cgi?id=736655

tests/check/pipelines/streamsynchronizer.c

index cbc3d13..59cfb7b 100644 (file)
@@ -101,22 +101,22 @@ run_streamsynchronizer_handle_eos (const gchar * launch_line)
   fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ASYNC_DONE);
   gst_message_unref (msg);
 
-  fail_unless_equals_int (gst_element_get_state (pipeline, NULL, NULL, -1),
-      GST_STATE_CHANGE_SUCCESS);
+  fail_unless_equals_int (gst_element_get_state (pipeline, NULL, NULL,
+          GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
 
   fail_unless (gst_element_set_state (pipeline, GST_STATE_PAUSED) !=
       GST_STATE_CHANGE_FAILURE);
 
-  /* wait for preroll */
-  msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
-      GST_MESSAGE_ASYNC_DONE | GST_MESSAGE_ERROR);
-
-  fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ASYNC_DONE);
-  gst_message_unref (msg);
+  /* can't ensure can received async-done message when call state change very quickly. */
+  fail_unless_equals_int (gst_element_get_state (pipeline, NULL, NULL,
+          GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
 
   fail_unless (gst_element_set_state (pipeline, GST_STATE_PLAYING) !=
       GST_STATE_CHANGE_FAILURE);
 
+  fail_unless_equals_int (gst_element_get_state (pipeline, NULL, NULL,
+          GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
+
   gst_element_set_state (pipeline, GST_STATE_NULL);
 
   gst_object_unref (bus);