[gst-cvs] gst-plugins-good: flvdemux: Fix tests warning from setting a NULL index

Jan Schmidt thaytan at kemper.freedesktop.org
Mon Aug 31 04:11:20 PDT 2009


Module: gst-plugins-good
Branch: master
Commit: 3f69f8d3ee0ea812ba73e66a6d16e5d0a7e536b9
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=3f69f8d3ee0ea812ba73e66a6d16e5d0a7e536b9

Author: Jan Schmidt <thaytan at noraisin.net>
Date:   Mon Aug 31 11:32:39 2009 +0100

flvdemux: Fix tests warning from setting a NULL index

Setting a null index in the tests was causing warnings by unreffing
NULL pointers. This is a bug exposed by a recent change in core, it
seems.

---

 gst/flv/gstflvdemux.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c
index 59a12d0..1f70002 100644
--- a/gst/flv/gstflvdemux.c
+++ b/gst/flv/gstflvdemux.c
@@ -1183,11 +1183,14 @@ gst_flv_demux_set_index (GstElement * element, GstIndex * index)
   GST_OBJECT_LOCK (demux);
   if (demux->index)
     gst_object_unref (demux->index);
-  demux->index = gst_object_ref (index);
-  GST_OBJECT_UNLOCK (demux);
+  if (index) {
+    demux->index = gst_object_ref (index);
+    gst_index_get_writer_id (index, GST_OBJECT (element), &demux->index_id);
+    demux->own_index = FALSE;
+  } else
+    demux->index = NULL;
 
-  gst_index_get_writer_id (index, GST_OBJECT (element), &demux->index_id);
-  demux->own_index = FALSE;
+  GST_OBJECT_UNLOCK (demux);
 }
 
 static GstIndex *





More information about the Gstreamer-commits mailing list