summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-08-14 14:56:20 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-08-14 14:56:20 +0000
commita2dbc1182cf6b170507b9578eaba097a921d620a (patch)
treef3dc87cdac72888e37962e06ed5ef171e1c08c17
parent170c01e6c1ea98c3162819d5d2d7007a7cab6d8d (diff)
downloadgst-plugins-bad-a2dbc1182cf6b170507b9578eaba097a921d620a.tar.gz
gst-plugins-bad-a2dbc1182cf6b170507b9578eaba097a921d620a.tar.bz2
gst-plugins-bad-a2dbc1182cf6b170507b9578eaba097a921d620a.zip
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.
-rw-r--r--ChangeLog6
-rw-r--r--gst/flv/gstflvdemux.c13
2 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 65532099..5402d205 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-08-14 Wim Taymans <wim.taymans@gmail.com>
+
+ * gst/flv/gstflvdemux.c: (gst_flv_demux_set_index),
+ (gst_flv_demux_get_index):
+ Fix locking and refcounting on the index.
+
2007-08-14 Julien MOUTTE <julien@moutte.net>
* gst/flv/gstflvdemux.c: (gst_flv_demux_cleanup),
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