From 208d02b5e4049173f2ee46fb4cd7914a4286cd15 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 31 Aug 2006 12:31:00 +0000 Subject: [PATCH] ext/ogg/gstoggdemux.c: Send the GST_EVENT_NEW_SEGMENT from the streaming thread. Original commit message from CVS: * ext/ogg/gstoggdemux.c: (gst_ogg_demux_init), (gst_ogg_demux_finalize), (gst_ogg_demux_perform_seek), (gst_ogg_demux_loop): Send the GST_EVENT_NEW_SEGMENT from the streaming thread. --- ChangeLog | 7 +++++++ ext/ogg/gstoggdemux.c | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5383e03c2e..b39bbba3ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-08-31 Edward Hervey + + * ext/ogg/gstoggdemux.c: (gst_ogg_demux_init), + (gst_ogg_demux_finalize), (gst_ogg_demux_perform_seek), + (gst_ogg_demux_loop): + Send the GST_EVENT_NEW_SEGMENT from the streaming thread. + 2006-08-30 Tim-Philipp Müller * gst/ffmpegcolorspace/gstffmpegcolorspace.c: diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 781052f199..77fe4dddba 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -182,6 +182,7 @@ struct _GstOggDemux gboolean segment_running; GstEvent *event; + GstEvent *newsegment; /* pending newsegment to be sent from _loop */ gint64 current_granule; @@ -1438,6 +1439,7 @@ gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class) ogg->chain_lock = g_mutex_new (); ogg->chains = g_array_new (FALSE, TRUE, sizeof (GstOggChain *)); + ogg->newsegment = NULL; } static void @@ -1451,6 +1453,9 @@ gst_ogg_demux_finalize (GObject * object) g_mutex_free (ogg->chain_lock); ogg_sync_clear (&ogg->sync); + if (ogg->newsegment) + gst_event_unref (ogg->newsegment); + G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -2108,7 +2113,10 @@ gst_ogg_demux_perform_seek (GstOggDemux * ogg, GstEvent * event) } else { /* mark discont and send segment on current chain */ gst_ogg_chain_mark_discont (chain); - gst_ogg_demux_send_event (ogg, event); + /* This event should be sent from the streaming thread (sink pad task) */ + if (ogg->newsegment) + gst_event_unref (ogg->newsegment); + ogg->newsegment = event; } /* notify start of new segment */ @@ -2826,6 +2834,11 @@ gst_ogg_demux_loop (GstOggPad * pad) ogg->offset += GST_BUFFER_SIZE (buffer); + if (G_UNLIKELY (ogg->newsegment)) { + gst_ogg_demux_send_event (ogg, ogg->newsegment); + ogg->newsegment = NULL; + } + ret = gst_ogg_demux_chain (ogg->sinkpad, buffer); if (ret != GST_FLOW_OK) { GST_LOG_OBJECT (ogg, "Failed demux_chain");