From 8877f3590d6dc4558099aaf3b632a7d5084fbdb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 27 Oct 2008 09:14:45 +0000 Subject: gst/flv/gstflvdemux.*: If our index was created by the element and not provided from the outside we should destroy it... Original commit message from CVS: * gst/flv/gstflvdemux.c: (gst_flv_demux_change_state), (gst_flv_demux_set_index), (gst_flv_demux_init): * gst/flv/gstflvdemux.h: If our index was created by the element and not provided from the outside we should destroy it when starting a new stream to get all old entries removed. --- ChangeLog | 9 +++++++++ gst/flv/gstflvdemux.c | 12 ++++++++++++ gst/flv/gstflvdemux.h | 1 + 3 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 21e6f087..80058b0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-27 Sebastian Dröge + + * gst/flv/gstflvdemux.c: (gst_flv_demux_change_state), + (gst_flv_demux_set_index), (gst_flv_demux_init): + * gst/flv/gstflvdemux.h: + If our index was created by the element and not provided from the + outside we should destroy it when starting a new stream to get + all old entries removed. + 2008-10-27 Sebastian Dröge * gst/flv/gstflvdemux.c: (gst_flv_demux_pull_range): diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c index a9984323..3ab2edc7 100644 --- a/gst/flv/gstflvdemux.c +++ b/gst/flv/gstflvdemux.c @@ -1064,6 +1064,14 @@ gst_flv_demux_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: + /* If this is our own index destroy it as the + * old entries might be wrong for the new stream */ + if (demux->own_index) { + gst_object_unref (demux->index); + demux->index = NULL; + demux->own_index = FALSE; + } + /* If no index was created, generate one */ if (G_UNLIKELY (!demux->index)) { GST_DEBUG_OBJECT (demux, "no index provided creating our own"); @@ -1072,6 +1080,7 @@ gst_flv_demux_change_state (GstElement * element, GstStateChange transition) gst_index_get_writer_id (demux->index, GST_OBJECT (demux), &demux->index_id); + demux->own_index = TRUE; } gst_flv_demux_cleanup (demux); break; @@ -1106,6 +1115,7 @@ gst_flv_demux_set_index (GstElement * element, GstIndex * index) GST_OBJECT_UNLOCK (demux); gst_index_get_writer_id (index, GST_OBJECT (element), &demux->index_id); + demux->own_index = FALSE; } static GstIndex * @@ -1249,6 +1259,8 @@ gst_flv_demux_init (GstFLVDemux * demux, GstFLVDemuxClass * g_class) demux->taglist = gst_tag_list_new (); gst_segment_init (demux->segment, GST_FORMAT_TIME); + demux->own_index = FALSE; + gst_flv_demux_cleanup (demux); } diff --git a/gst/flv/gstflvdemux.h b/gst/flv/gstflvdemux.h index 210db2fd..3eb99ce0 100644 --- a/gst/flv/gstflvdemux.h +++ b/gst/flv/gstflvdemux.h @@ -59,6 +59,7 @@ struct _GstFLVDemux GstIndex *index; gint index_id; + gboolean own_index; GArray * times; GArray * filepositions; -- cgit v1.2.1