gst/playback/gstplaybasebin.c: Actually clean up streaminfo if output fails. This...
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Sat, 9 Oct 2004 13:50:33 +0000 (13:50 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Sat, 9 Oct 2004 13:50:33 +0000 (13:50 +0000)
Original commit message from CVS:
* gst/playback/gstplaybasebin.c: (setup_source),
(gst_play_base_bin_change_state):
Actually clean up streaminfo if output fails. This would trigger
if, for example, there was no CD in the drive. No preroll, so
a streaminfo structure is created, but the subsequent state change
of the thread fails.
* gst/playback/gstplaybin.c: (gst_play_bin_change_state):
Don't change state if parent failed.

ChangeLog
gst/playback/gstplaybasebin.c
gst/playback/gstplaybin.c

index 5fa5389..182893c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-10-09  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
+       * gst/playback/gstplaybasebin.c: (setup_source),
+       (gst_play_base_bin_change_state):
+         Actually clean up streaminfo if output fails. This would trigger
+         if, for example, there was no CD in the drive. No preroll, so
+         a streaminfo structure is created, but the subsequent state change
+         of the thread fails.
+       * gst/playback/gstplaybin.c: (gst_play_bin_change_state):
+         Don't change state if parent failed.
+
 2004-10-08  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * gst/playback/gstplaybin.c: (gst_play_bin_class_init),
index 9fb48ee..d8d40e0 100644 (file)
@@ -403,6 +403,10 @@ setup_source (GstPlayBaseBin * play_base_bin)
       gst_bin_remove (GST_BIN (play_base_bin->thread), old_src);
     }
     gst_bin_add (GST_BIN (play_base_bin->thread), play_base_bin->source);
+    if (gst_bin_sync_children_state (GST_BIN (play_base_bin->thread)) ==
+        GST_STATE_FAILURE) {
+      return FALSE;
+    }
   }
 
   /* now see if the source element emits raw audio/video all by itself,
@@ -670,6 +674,12 @@ gst_play_base_bin_change_state (GstElement * element)
          * because one stream was unrecognized. */
         g_signal_connect (play_base_bin->thread, "error",
             G_CALLBACK (gst_play_base_bin_error), play_base_bin);
+      } else {
+        /* in case of no preroll, we might have streaminfo already... */
+        g_list_foreach (play_base_bin->streaminfo,
+            (GFunc) g_object_unref, NULL);
+        g_list_free (play_base_bin->streaminfo);
+        play_base_bin->streaminfo = NULL;
       }
       break;
     }
index 145dd20..6183bf6 100644 (file)
@@ -527,6 +527,8 @@ gst_play_bin_change_state (GstElement * element)
   transition = GST_STATE_TRANSITION (element);
 
   ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
+  if (ret == GST_STATE_FAILURE)
+    return ret;
 
   switch (transition) {
     case GST_STATE_NULL_TO_READY: