summaryrefslogtreecommitdiffstats
path: root/gst/flv
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-08-14 14:56:20 +0000
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-05-12 21:20:50 +0200
commitd83e2e92921e0048b83d967ecaccf19186478842 (patch)
tree17d9f28d33f19b9d8d27b9edb3b329b9ce59fb05 /gst/flv
parentc3228fbb674cf0da8fc629ef6bd4b8090e56a2b4 (diff)
[MOVED FROM BAD 04/57] gst/flv/gstflvdemux.c: Fix locking and refcounting on the index.
Original commit message from CVS: * gst/flv/gstflvdemux.c: (gst_flv_demux_set_index), (gst_flv_demux_get_index): Fix locking and refcounting on the index.
Diffstat (limited to 'gst/flv')
-rw-r--r--gst/flv/gstflvdemux.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c
index 339fc0d7..3f727f1c 100644
--- a/gst/flv/gstflvdemux.c
+++ b/gst/flv/gstflvdemux.c
@@ -911,7 +911,11 @@ gst_flv_demux_set_index (GstElement * element, GstIndex * index)
{
GstFLVDemux *demux = GST_FLV_DEMUX (element);
+ GST_OBJECT_LOCK (demux);
+ if (demux->index)
+ gst_object_unref (demux->index);
demux->index = gst_object_ref (index);
+ GST_OBJECT_UNLOCK (demux);
gst_index_get_writer_id (index, GST_OBJECT (element), &demux->index_id);
}
@@ -919,9 +923,16 @@ gst_flv_demux_set_index (GstElement * element, GstIndex * index)
static GstIndex *
gst_flv_demux_get_index (GstElement * element)
{
+ GstIndex *result = NULL;
+
GstFLVDemux *demux = GST_FLV_DEMUX (element);
- return demux->index;
+ GST_OBJECT_LOCK (demux);
+ if (demux->index)
+ result = gst_object_ref (demux->index);
+ GST_OBJECT_UNLOCK (demux);
+
+ return result;
}
static void