mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
[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.
This commit is contained in:
parent
c3228fbb67
commit
d83e2e9292
1 changed files with 12 additions and 1 deletions
|
@ -911,7 +911,11 @@ gst_flv_demux_set_index (GstElement * element, GstIndex * index)
|
||||||
{
|
{
|
||||||
GstFLVDemux *demux = GST_FLV_DEMUX (element);
|
GstFLVDemux *demux = GST_FLV_DEMUX (element);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (demux);
|
||||||
|
if (demux->index)
|
||||||
|
gst_object_unref (demux->index);
|
||||||
demux->index = gst_object_ref (index);
|
demux->index = gst_object_ref (index);
|
||||||
|
GST_OBJECT_UNLOCK (demux);
|
||||||
|
|
||||||
gst_index_get_writer_id (index, GST_OBJECT (element), &demux->index_id);
|
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 *
|
static GstIndex *
|
||||||
gst_flv_demux_get_index (GstElement * element)
|
gst_flv_demux_get_index (GstElement * element)
|
||||||
{
|
{
|
||||||
|
GstIndex *result = NULL;
|
||||||
|
|
||||||
GstFLVDemux *demux = GST_FLV_DEMUX (element);
|
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
|
static void
|
||||||
|
|
Loading…
Reference in a new issue