From 9b139e41fbbdc55d14053484f725be8dfa4b8be3 Mon Sep 17 00:00:00 2001 From: Ville Syrjala Date: Fri, 13 Oct 2006 14:15:42 +0000 Subject: [PATCH] gst-libs/gst/audio/gstbaseaudiosink.c: Don't crash when ringbuffer is not yet created. Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_setcaps): Don't crash when ringbuffer is not yet created. Patch by: Ville Syrjala Fixes #361634. * gst/playback/gstplaybasebin.c: (new_decoded_pad_full): * gst/playback/gststreamselector.c: (gst_stream_selector_request_new_pad): Activate pads befre adding them to running elements. --- ChangeLog | 13 +++++++++++++ gst-libs/gst/audio/gstbaseaudiosink.c | 3 +++ gst/playback/gstplaybasebin.c | 1 - gst/playback/gststreamselector.c | 3 ++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e91dcd17b6..781aea9c2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-10-13 Wim Taymans + + * gst-libs/gst/audio/gstbaseaudiosink.c: + (gst_base_audio_sink_setcaps): + Don't crash when ringbuffer is not yet created. + Patch by: Ville Syrjala + Fixes #361634. + + * gst/playback/gstplaybasebin.c: (new_decoded_pad_full): + * gst/playback/gststreamselector.c: + (gst_stream_selector_request_new_pad): + Activate pads befre adding them to running elements. + 2006-10-13 Julien MOUTTE * tests/examples/seek/seek.c: (do_seek), (start_seek), diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c index acbe94f89f..720fd4613e 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.c +++ b/gst-libs/gst/audio/gstbaseaudiosink.c @@ -316,6 +316,9 @@ gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink); GstRingBufferSpec *spec; + if (!sink->ringbuffer) + return FALSE; + spec = &sink->ringbuffer->spec; GST_DEBUG_OBJECT (sink, "release old ringbuffer"); diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index b611c27fdc..dcbb7f7c9e 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -1205,7 +1205,6 @@ new_decoded_pad_full (GstElement * element, GstPad * pad, gboolean last, /* Store a pointer to the stream selector pad for this stream */ g_object_set_data (G_OBJECT (pad), "pb_sel_pad", sinkpad); - gst_pad_set_active (sinkpad, TRUE); gst_pad_link (pad, sinkpad); gst_object_unref (sinkpad); diff --git a/gst/playback/gststreamselector.c b/gst/playback/gststreamselector.c index 373c660033..b35b8169c0 100644 --- a/gst/playback/gststreamselector.c +++ b/gst/playback/gststreamselector.c @@ -354,11 +354,11 @@ gst_stream_selector_request_new_pad (GstElement * element, GST_LOG_OBJECT (sel, "Creating new pad %d", sel->nb_sinkpads); + GST_OBJECT_LOCK (sel); name = g_strdup_printf ("sink%d", sel->nb_sinkpads++); sinkpad = gst_pad_new_from_template (templ, name); g_free (name); - GST_OBJECT_LOCK (sel); if (sel->active_sinkpad == NULL) sel->active_sinkpad = gst_object_ref (sinkpad); GST_OBJECT_UNLOCK (sel); @@ -372,6 +372,7 @@ gst_stream_selector_request_new_pad (GstElement * element, gst_pad_set_bufferalloc_function (sinkpad, GST_DEBUG_FUNCPTR (gst_stream_selector_bufferalloc)); + gst_pad_set_active (sinkpad, TRUE); gst_element_add_pad (GST_ELEMENT (sel), sinkpad); return sinkpad; -- 2.34.1