ext/gconf/: When we can't create a fakesink/fakesrc complain instead of unreffing
Original commit message from CVS: * 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.
This commit is contained in:
parent
34f916abbd
commit
24e21ae6e9
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2008-05-02 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_process):
|
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_process):
|
||||||
|
@ -71,7 +71,7 @@ gst_gconf_audio_src_class_init (GstGConfAudioSrcClass * klass)
|
|||||||
* Hack to make negotiation work.
|
* Hack to make negotiation work.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gst_gconf_audio_src_reset (GstGConfAudioSrc * src)
|
gst_gconf_audio_src_reset (GstGConfAudioSrc * src)
|
||||||
{
|
{
|
||||||
GstPad *targetpad;
|
GstPad *targetpad;
|
||||||
@ -82,6 +82,10 @@ gst_gconf_audio_src_reset (GstGConfAudioSrc * src)
|
|||||||
gst_bin_remove (GST_BIN (src), src->kid);
|
gst_bin_remove (GST_BIN (src), src->kid);
|
||||||
}
|
}
|
||||||
src->kid = gst_element_factory_make ("fakesrc", "testsrc");
|
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);
|
gst_bin_add (GST_BIN (src), src->kid);
|
||||||
|
|
||||||
targetpad = gst_element_get_pad (src->kid, "src");
|
targetpad = gst_element_get_pad (src->kid, "src");
|
||||||
@ -90,6 +94,7 @@ gst_gconf_audio_src_reset (GstGConfAudioSrc * src)
|
|||||||
|
|
||||||
g_free (src->gconf_str);
|
g_free (src->gconf_str);
|
||||||
src->gconf_str = NULL;
|
src->gconf_str = NULL;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -225,7 +230,8 @@ gst_gconf_audio_src_change_state (GstElement * element,
|
|||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -70,7 +70,7 @@ gst_gconf_video_sink_class_init (GstGConfVideoSinkClass * klass)
|
|||||||
* Hack to make negotiation work.
|
* Hack to make negotiation work.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gst_gconf_video_sink_reset (GstGConfVideoSink * sink)
|
gst_gconf_video_sink_reset (GstGConfVideoSink * sink)
|
||||||
{
|
{
|
||||||
GstPad *targetpad;
|
GstPad *targetpad;
|
||||||
@ -81,6 +81,10 @@ gst_gconf_video_sink_reset (GstGConfVideoSink * sink)
|
|||||||
gst_bin_remove (GST_BIN (sink), sink->kid);
|
gst_bin_remove (GST_BIN (sink), sink->kid);
|
||||||
}
|
}
|
||||||
sink->kid = gst_element_factory_make ("fakesink", "testsink");
|
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);
|
gst_bin_add (GST_BIN (sink), sink->kid);
|
||||||
|
|
||||||
targetpad = gst_element_get_pad (sink->kid, "sink");
|
targetpad = gst_element_get_pad (sink->kid, "sink");
|
||||||
@ -89,6 +93,8 @@ gst_gconf_video_sink_reset (GstGConfVideoSink * sink)
|
|||||||
|
|
||||||
g_free (sink->gconf_str);
|
g_free (sink->gconf_str);
|
||||||
sink->gconf_str = NULL;
|
sink->gconf_str = NULL;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -223,7 +229,8 @@ gst_gconf_video_sink_change_state (GstElement * element,
|
|||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -71,7 +71,7 @@ gst_gconf_video_src_class_init (GstGConfVideoSrcClass * klass)
|
|||||||
* Hack to make negotiation work.
|
* Hack to make negotiation work.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gst_gconf_video_src_reset (GstGConfVideoSrc * src)
|
gst_gconf_video_src_reset (GstGConfVideoSrc * src)
|
||||||
{
|
{
|
||||||
GstPad *targetpad;
|
GstPad *targetpad;
|
||||||
@ -82,6 +82,10 @@ gst_gconf_video_src_reset (GstGConfVideoSrc * src)
|
|||||||
gst_bin_remove (GST_BIN (src), src->kid);
|
gst_bin_remove (GST_BIN (src), src->kid);
|
||||||
}
|
}
|
||||||
src->kid = gst_element_factory_make ("fakesrc", "testsrc");
|
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);
|
gst_bin_add (GST_BIN (src), src->kid);
|
||||||
|
|
||||||
targetpad = gst_element_get_pad (src->kid, "src");
|
targetpad = gst_element_get_pad (src->kid, "src");
|
||||||
@ -90,6 +94,8 @@ gst_gconf_video_src_reset (GstGConfVideoSrc * src)
|
|||||||
|
|
||||||
g_free (src->gconf_str);
|
g_free (src->gconf_str);
|
||||||
src->gconf_str = NULL;
|
src->gconf_str = NULL;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -217,7 +223,8 @@ gst_gconf_video_src_change_state (GstElement * element,
|
|||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -76,15 +76,17 @@ gst_switch_sink_class_init (GstSwitchSinkClass * klass)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gst_switch_sink_reset (GstSwitchSink * sink)
|
gst_switch_sink_reset (GstSwitchSink * sink)
|
||||||
{
|
{
|
||||||
/* this will install fakesink if no other child has been set,
|
/* this will install fakesink if no other child has been set,
|
||||||
* otherwise we rely on the subclass to know when to unset its
|
* otherwise we rely on the subclass to know when to unset its
|
||||||
* custom kid */
|
* custom kid */
|
||||||
if (sink->kid == NULL) {
|
if (sink->kid == NULL) {
|
||||||
gst_switch_sink_set_child (sink, NULL);
|
return gst_switch_sink_set_child (sink, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -143,6 +145,10 @@ gst_switch_commit_new_kid (GstSwitchSink * sink)
|
|||||||
if (new_kid == NULL) {
|
if (new_kid == NULL) {
|
||||||
GST_DEBUG_OBJECT (sink, "Replacing kid with fakesink");
|
GST_DEBUG_OBJECT (sink, "Replacing kid with fakesink");
|
||||||
new_kid = gst_element_factory_make ("fakesink", "testsink");
|
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 */
|
/* Add a reference, as it would if the element came from sink->new_kid */
|
||||||
gst_object_ref (new_kid);
|
gst_object_ref (new_kid);
|
||||||
g_object_set (new_kid, "sync", TRUE, NULL);
|
g_object_set (new_kid, "sync", TRUE, NULL);
|
||||||
@ -299,7 +305,8 @@ gst_switch_sink_change_state (GstElement * element, GstStateChange transition)
|
|||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
gst_switch_sink_reset (sink);
|
if (!gst_switch_sink_reset (sink))
|
||||||
|
ret = GST_STATE_CHANGE_FAILURE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user