gst-libs/gst/audio/gstbaseaudiosink.c: Don't crash when ringbuffer is not yet created.
authorVille Syrjala <ville.syrjala@movial.fi>
Fri, 13 Oct 2006 14:15:42 +0000 (14:15 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 13 Oct 2006 14:15:42 +0000 (14:15 +0000)
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 <ville dot syrjala at movial dot fi>
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
gst-libs/gst/audio/gstbaseaudiosink.c
gst/playback/gstplaybasebin.c
gst/playback/gststreamselector.c

index e91dcd1..781aea9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-10-13  Wim Taymans  <wim@fluendo.com>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       (gst_base_audio_sink_setcaps):
+       Don't crash when ringbuffer is not yet created.
+       Patch by: Ville Syrjala <ville dot syrjala at movial dot fi>
+       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  <julien@moutte.net>
 
        * tests/examples/seek/seek.c: (do_seek), (start_seek),
index acbe94f..720fd46 100644 (file)
@@ -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");
index b611c27..dcbb7f7 100644 (file)
@@ -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);
 
index 373c660..b35b816 100644 (file)
@@ -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;