splitmux: Shut down element before downward state change
authorJan Schmidt <jan@centricular.com>
Tue, 10 Mar 2015 04:46:40 +0000 (15:46 +1100)
committerJan Schmidt <jan@centricular.com>
Tue, 10 Mar 2015 04:49:33 +0000 (15:49 +1100)
Make sure the state change won't hang trying to shut down pads
by making sure the streaming has stopped before chaining up.

gst/multifile/gstsplitmuxsrc.c

index 61f0c0642b47c8225bbeddc2ba46ab89c03df72c..ea3ea7579d465037998764191cccc9069dcf1dba 100644 (file)
@@ -309,17 +309,7 @@ gst_splitmux_src_change_state (GstElement * element, GstStateChange transition)
     }
     case GST_STATE_CHANGE_PAUSED_TO_READY:
     case GST_STATE_CHANGE_READY_TO_NULL:
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-  if (ret == GST_STATE_CHANGE_FAILURE)
-    goto beach;
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_NULL:
+      /* Make sure the element will shut down */
       if (!gst_splitmux_src_stop (splitmux))
         return GST_STATE_CHANGE_FAILURE;
       break;
@@ -327,7 +317,8 @@ gst_splitmux_src_change_state (GstElement * element, GstStateChange transition)
       break;
   }
 
-beach:
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
   return ret;
 }