+2008-05-03 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_reset),
+ (gst_gconf_audio_src_change_state):
+ * ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_reset),
+ (gst_gconf_video_sink_change_state):
+ * ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_reset),
+ (gst_gconf_video_src_change_state):
+ * ext/gconf/gstswitchsink.c: (gst_switch_sink_reset),
+ (gst_switch_commit_new_kid), (gst_switch_sink_change_state):
+ When we can't create a fakesink/fakesrc complain instead of unreffing
+ NULL pointers and crashing later. See bug #530535.
+
2008-05-02 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_process):
* Hack to make negotiation work.
*/
-static void
+static gboolean
gst_gconf_audio_src_reset (GstGConfAudioSrc * src)
{
GstPad *targetpad;
gst_bin_remove (GST_BIN (src), src->kid);
}
src->kid = gst_element_factory_make ("fakesrc", "testsrc");
+ if (!src->kid) {
+ GST_ERROR_OBJECT (src, "Failed to create fakesrc");
+ return FALSE;
+ }
gst_bin_add (GST_BIN (src), src->kid);
targetpad = gst_element_get_pad (src->kid, "src");
g_free (src->gconf_str);
src->gconf_str = NULL;
+ return TRUE;
}
static void
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
- gst_gconf_audio_src_reset (src);
+ if (!gst_gconf_audio_src_reset (src))
+ ret = GST_STATE_CHANGE_FAILURE;
break;
default:
break;
* Hack to make negotiation work.
*/
-static void
+static gboolean
gst_gconf_video_sink_reset (GstGConfVideoSink * sink)
{
GstPad *targetpad;
gst_bin_remove (GST_BIN (sink), sink->kid);
}
sink->kid = gst_element_factory_make ("fakesink", "testsink");
+ if (!sink->kid) {
+ GST_ERROR_OBJECT (sink, "Failed to create fakesink");
+ return FALSE;
+ }
gst_bin_add (GST_BIN (sink), sink->kid);
targetpad = gst_element_get_pad (sink->kid, "sink");
g_free (sink->gconf_str);
sink->gconf_str = NULL;
+
+ return TRUE;
}
static void
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
- gst_gconf_video_sink_reset (sink);
+ if (!gst_gconf_video_sink_reset (sink))
+ ret = GST_STATE_CHANGE_FAILURE;
break;
default:
break;
* Hack to make negotiation work.
*/
-static void
+static gboolean
gst_gconf_video_src_reset (GstGConfVideoSrc * src)
{
GstPad *targetpad;
gst_bin_remove (GST_BIN (src), src->kid);
}
src->kid = gst_element_factory_make ("fakesrc", "testsrc");
+ if (!src->kid) {
+ GST_ERROR_OBJECT (src, "Failed to create fakesrc");
+ return FALSE;
+ }
gst_bin_add (GST_BIN (src), src->kid);
targetpad = gst_element_get_pad (src->kid, "src");
g_free (src->gconf_str);
src->gconf_str = NULL;
+
+ return TRUE;
}
static void
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
- gst_gconf_video_src_reset (src);
+ if (!gst_gconf_video_src_reset (src))
+ ret = GST_STATE_CHANGE_FAILURE;
break;
default:
break;
}
}
-static void
+static gboolean
gst_switch_sink_reset (GstSwitchSink * sink)
{
/* this will install fakesink if no other child has been set,
* otherwise we rely on the subclass to know when to unset its
* custom kid */
if (sink->kid == NULL) {
- gst_switch_sink_set_child (sink, NULL);
+ return gst_switch_sink_set_child (sink, NULL);
}
+
+ return TRUE;
}
static void
if (new_kid == NULL) {
GST_DEBUG_OBJECT (sink, "Replacing kid with fakesink");
new_kid = gst_element_factory_make ("fakesink", "testsink");
+ if (new_kid == NULL) {
+ GST_ERROR_OBJECT (sink, "Failed to create fakesink");
+ return FALSE;
+ }
/* Add a reference, as it would if the element came from sink->new_kid */
gst_object_ref (new_kid);
g_object_set (new_kid, "sync", TRUE, NULL);
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
- gst_switch_sink_reset (sink);
+ if (!gst_switch_sink_reset (sink))
+ ret = GST_STATE_CHANGE_FAILURE;
break;
default:
break;