check/states/sinks.c: Uncomment fixed check.
authorWim Taymans <wim.taymans@gmail.com>
Thu, 3 Nov 2005 20:14:24 +0000 (20:14 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 3 Nov 2005 20:14:24 +0000 (20:14 +0000)
Original commit message from CVS:
* check/states/sinks.c: (GST_START_TEST):
Uncomment fixed check.

* docs/design/part-TODO.txt:
Updated TODO.

* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_do_sync),
(gst_base_sink_get_position):
If we are going to PLAYING, post the right pending state
when we post the intermediate paused message.

* gst/gstelement.c: (gst_element_continue_state),
(gst_element_set_state_func), (gst_element_change_state):
Don't post state changes that were between the same state
and were not ASYNC.

ChangeLog
check/states/sinks.c
docs/design/part-TODO.txt
gst/base/gstbasesink.c
gst/gstelement.c
libs/gst/base/gstbasesink.c
tests/check/generic/sinks.c

index 207dc76..ad94320 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2005-11-03  Wim Taymans  <wim@fluendo.com>
+
+       * check/states/sinks.c: (GST_START_TEST):
+       Uncomment fixed check.
+
+       * docs/design/part-TODO.txt:
+       Updated TODO.
+
+       * gst/base/gstbasesink.c: (gst_base_sink_commit_state),
+       (gst_base_sink_handle_object), (gst_base_sink_do_sync),
+       (gst_base_sink_get_position):
+       If we are going to PLAYING, post the right pending state
+       when we post the intermediate paused message.
+
+       * gst/gstelement.c: (gst_element_continue_state),
+       (gst_element_set_state_func), (gst_element_change_state):
+       Don't post state changes that were between the same state
+       and were not ASYNC.
+
 2005-11-03  Stefan Kost  <ensonic@users.sf.net>
 
        * docs/gst/gstreamer-sections.txt:
index e0aa77e..1fb292b 100644 (file)
@@ -279,7 +279,6 @@ GST_START_TEST (test_livesrc_sink)
   fail_unless (current == GST_STATE_PLAYING, "not playing");
   fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
 
-#ifdef WIM_EARNS_HIS_KEEP
   /* now we have four messages on the bus: src from paused to playing, sink from
      ready to paused and paused to playing, and pipeline from paused to playing.
      the pipeline message should be last, and the sink messages should go in
@@ -323,7 +322,6 @@ GST_START_TEST (test_livesrc_sink)
 
   pop_state_change_message (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING,
       GST_STATE_VOID_PENDING);
-#endif
 
   gst_object_unref (bus);
   gst_element_set_state (pipeline, GST_STATE_NULL);
index 77a77ba..821ce30 100644 (file)
@@ -40,3 +40,5 @@
 - GstQuery quark, get_name.
 
 - GstEvent, GstMessage register like GstFormat or GstQuery.
+
+- unblocking while seeking. gst_element_flush_pads (GstElement, gboolean);
index 4b4315b..8cc2c95 100644 (file)
@@ -448,7 +448,7 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
 {
   /* commit state and proceed to next pending state */
   {
-    GstState current, next, pending;
+    GstState current, next, pending, post_pending;
     GstMessage *message;
     gboolean post_paused = FALSE;
     gboolean post_playing = FALSE;
@@ -457,18 +457,21 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
     current = GST_STATE (basesink);
     next = GST_STATE_NEXT (basesink);
     pending = GST_STATE_PENDING (basesink);
+    post_pending = pending;
 
     switch (pending) {
       case GST_STATE_PLAYING:
         basesink->need_preroll = FALSE;
         post_playing = TRUE;
         /* post PAUSED too when we were READY */
-        if (current == GST_STATE_READY)
+        if (current == GST_STATE_READY) {
           post_paused = TRUE;
+        }
         break;
       case GST_STATE_PAUSED:
         basesink->need_preroll = TRUE;
         post_paused = TRUE;
+        post_pending = GST_STATE_VOID_PENDING;
         break;
       case GST_STATE_READY:
         goto stopping;
@@ -486,7 +489,7 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
 
     if (post_paused) {
       message = gst_message_new_state_changed (GST_OBJECT_CAST (basesink),
-          current, next, GST_STATE_VOID_PENDING);
+          current, next, post_pending);
       gst_element_post_message (GST_ELEMENT_CAST (basesink), message);
     }
     if (post_playing) {
index 492d80c..85d7bd7 100644 (file)
@@ -1817,12 +1817,13 @@ GstStateChangeReturn
 gst_element_continue_state (GstElement * element, GstStateChangeReturn ret)
 {
   GstState pending;
-  GstState old_state, old_next;
+  GstState old_ret, old_state, old_next;
   GstState current, next;
   GstMessage *message;
   GstStateChange transition;
 
   GST_LOCK (element);
+  old_ret = GST_STATE_RETURN (element);
   GST_STATE_RETURN (element) = ret;
   pending = GST_STATE_PENDING (element);
 
@@ -1879,9 +1880,17 @@ complete:
     GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "completed state change");
     GST_UNLOCK (element);
 
-    message = gst_message_new_state_changed (GST_OBJECT (element),
-        old_state, old_next, GST_STATE_VOID_PENDING);
-    gst_element_post_message (element, message);
+    /* don't post silly messages with the same state. This can happen
+     * when an element state is changed to what it already was. For bins
+     * this can be the result of a lost state, which we check with the
+     * previous return value. 
+     * We do signal the cond though as a _get_state() might be blocking 
+     * on it. */
+    if (old_state != old_next || old_ret == GST_STATE_CHANGE_ASYNC) {
+      message = gst_message_new_state_changed (GST_OBJECT (element),
+          old_state, old_next, GST_STATE_VOID_PENDING);
+      gst_element_post_message (element, message);
+    }
 
     GST_STATE_BROADCAST (element);
 
index 4b4315b..8cc2c95 100644 (file)
@@ -448,7 +448,7 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
 {
   /* commit state and proceed to next pending state */
   {
-    GstState current, next, pending;
+    GstState current, next, pending, post_pending;
     GstMessage *message;
     gboolean post_paused = FALSE;
     gboolean post_playing = FALSE;
@@ -457,18 +457,21 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
     current = GST_STATE (basesink);
     next = GST_STATE_NEXT (basesink);
     pending = GST_STATE_PENDING (basesink);
+    post_pending = pending;
 
     switch (pending) {
       case GST_STATE_PLAYING:
         basesink->need_preroll = FALSE;
         post_playing = TRUE;
         /* post PAUSED too when we were READY */
-        if (current == GST_STATE_READY)
+        if (current == GST_STATE_READY) {
           post_paused = TRUE;
+        }
         break;
       case GST_STATE_PAUSED:
         basesink->need_preroll = TRUE;
         post_paused = TRUE;
+        post_pending = GST_STATE_VOID_PENDING;
         break;
       case GST_STATE_READY:
         goto stopping;
@@ -486,7 +489,7 @@ gst_base_sink_commit_state (GstBaseSink * basesink)
 
     if (post_paused) {
       message = gst_message_new_state_changed (GST_OBJECT_CAST (basesink),
-          current, next, GST_STATE_VOID_PENDING);
+          current, next, post_pending);
       gst_element_post_message (GST_ELEMENT_CAST (basesink), message);
     }
     if (post_playing) {
index e0aa77e..1fb292b 100644 (file)
@@ -279,7 +279,6 @@ GST_START_TEST (test_livesrc_sink)
   fail_unless (current == GST_STATE_PLAYING, "not playing");
   fail_unless (pending == GST_STATE_VOID_PENDING, "not playing");
 
-#ifdef WIM_EARNS_HIS_KEEP
   /* now we have four messages on the bus: src from paused to playing, sink from
      ready to paused and paused to playing, and pipeline from paused to playing.
      the pipeline message should be last, and the sink messages should go in
@@ -323,7 +322,6 @@ GST_START_TEST (test_livesrc_sink)
 
   pop_state_change_message (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING,
       GST_STATE_VOID_PENDING);
-#endif
 
   gst_object_unref (bus);
   gst_element_set_state (pipeline, GST_STATE_NULL);