gst/base/gstbasesink.c: Don't free preroll queue too early.
authorWim Taymans <wim.taymans@gmail.com>
Thu, 19 May 2005 16:23:04 +0000 (16:23 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 19 May 2005 16:23:04 +0000 (16:23 +0000)
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_class_init),
(gst_basesink_init), (gst_basesink_finalize),
(gst_basesink_activate), (gst_basesink_change_state):
Don't free preroll queue too early.

ChangeLog
gst/base/gstbasesink.c
libs/gst/base/gstbasesink.c

index 68cebeb..6141e33 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-05-19  Wim Taymans  <wim@fluendo.com>
+
+       * gst/base/gstbasesink.c: (gst_basesink_class_init),
+       (gst_basesink_init), (gst_basesink_finalize),
+       (gst_basesink_activate), (gst_basesink_change_state):
+       Don't free preroll queue too early.
+
 2005-05-19  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * gst/Makefile.am:
index ca038df..e677f0e 100644 (file)
@@ -62,6 +62,7 @@ static GstElementClass *parent_class = NULL;
 static void gst_basesink_base_init (gpointer g_class);
 static void gst_basesink_class_init (GstBaseSinkClass * klass);
 static void gst_basesink_init (GstBaseSink * trans, gpointer g_class);
+static void gst_basesink_finalize (GObject * object);
 
 GType
 gst_basesink_get_type (void)
@@ -130,6 +131,7 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
+  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_basesink_finalize);
   gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesink_set_property);
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesink_get_property);
 
@@ -238,11 +240,24 @@ gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
 
   basesink->pad_mode = GST_ACTIVATE_NONE;
   GST_RPAD_TASK (basesink->sinkpad) = NULL;
+  basesink->preroll_queue = g_queue_new ();
 
   GST_FLAG_SET (basesink, GST_ELEMENT_IS_SINK);
 }
 
 static void
+gst_basesink_finalize (GObject * object)
+{
+  GstBaseSink *basesink;
+
+  basesink = GST_BASESINK (object);
+
+  g_queue_free (basesink->preroll_queue);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
 gst_basesink_set_pad_functions (GstBaseSink * this, GstPad * pad)
 {
   gst_pad_set_activate_function (pad,
@@ -835,7 +850,6 @@ gst_basesink_change_state (GstElement * element)
        * is no data flow in READY so we can safely assume we need to preroll. */
       basesink->offset = 0;
       GST_PREROLL_LOCK (basesink->sinkpad);
-      basesink->preroll_queue = g_queue_new ();
       basesink->need_preroll = TRUE;
       basesink->have_preroll = FALSE;
       GST_PREROLL_UNLOCK (basesink->sinkpad);
@@ -889,8 +903,6 @@ gst_basesink_change_state (GstElement * element)
       GST_PREROLL_LOCK (basesink->sinkpad);
 
       gst_basesink_preroll_queue_flush (basesink);
-      g_queue_free (basesink->preroll_queue);
-      basesink->preroll_queue = NULL;
 
       if (basesink->have_preroll)
         GST_PREROLL_SIGNAL (basesink->sinkpad);
index ca038df..e677f0e 100644 (file)
@@ -62,6 +62,7 @@ static GstElementClass *parent_class = NULL;
 static void gst_basesink_base_init (gpointer g_class);
 static void gst_basesink_class_init (GstBaseSinkClass * klass);
 static void gst_basesink_init (GstBaseSink * trans, gpointer g_class);
+static void gst_basesink_finalize (GObject * object);
 
 GType
 gst_basesink_get_type (void)
@@ -130,6 +131,7 @@ gst_basesink_class_init (GstBaseSinkClass * klass)
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
+  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_basesink_finalize);
   gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_basesink_set_property);
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_basesink_get_property);
 
@@ -238,11 +240,24 @@ gst_basesink_init (GstBaseSink * basesink, gpointer g_class)
 
   basesink->pad_mode = GST_ACTIVATE_NONE;
   GST_RPAD_TASK (basesink->sinkpad) = NULL;
+  basesink->preroll_queue = g_queue_new ();
 
   GST_FLAG_SET (basesink, GST_ELEMENT_IS_SINK);
 }
 
 static void
+gst_basesink_finalize (GObject * object)
+{
+  GstBaseSink *basesink;
+
+  basesink = GST_BASESINK (object);
+
+  g_queue_free (basesink->preroll_queue);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
 gst_basesink_set_pad_functions (GstBaseSink * this, GstPad * pad)
 {
   gst_pad_set_activate_function (pad,
@@ -835,7 +850,6 @@ gst_basesink_change_state (GstElement * element)
        * is no data flow in READY so we can safely assume we need to preroll. */
       basesink->offset = 0;
       GST_PREROLL_LOCK (basesink->sinkpad);
-      basesink->preroll_queue = g_queue_new ();
       basesink->need_preroll = TRUE;
       basesink->have_preroll = FALSE;
       GST_PREROLL_UNLOCK (basesink->sinkpad);
@@ -889,8 +903,6 @@ gst_basesink_change_state (GstElement * element)
       GST_PREROLL_LOCK (basesink->sinkpad);
 
       gst_basesink_preroll_queue_flush (basesink);
-      g_queue_free (basesink->preroll_queue);
-      basesink->preroll_queue = NULL;
 
       if (basesink->have_preroll)
         GST_PREROLL_SIGNAL (basesink->sinkpad);