From 07b59c93c2f724cbd23d45539847147ec5c21760 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 17 Sep 2014 17:27:25 -0300 Subject: [PATCH] hlsdemux: fix clearing of eos state in pads The internal pad still keeps its EOS flag and event as it can be assigned after the flush-start/stop pair is sent. The EOS is assigned from the streaming thread so this is racy. To be sure to clear it, it has to be done after setting the source to READY to be sure that its streaming thread isn't running. https://bugzilla.gnome.org/show_bug.cgi?id=736012 --- ext/hls/gsthlsdemux.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index 5dcb8bd096..00167291d5 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -1044,6 +1044,31 @@ _src_query (GstPad * pad, GstObject * parent, GstQuery * query) return gst_pad_query_default (pad, parent, query); } +static gboolean +_hls_demux_pad_remove_eos_sticky (GstPad * pad, GstEvent ** event, + gpointer udata) +{ + if (GST_EVENT_TYPE (*event) == GST_EVENT_EOS) { + gst_event_replace (event, NULL); + return FALSE; + } + return TRUE; +} + +static void +gst_hls_demux_stream_clear_eos_state (GstHLSDemux * demux) +{ + GstPad *internal_pad; + + internal_pad = + GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (demux->srcpad))); + gst_pad_sticky_events_foreach (internal_pad, + _hls_demux_pad_remove_eos_sticky, NULL); + GST_OBJECT_FLAG_UNSET (internal_pad, GST_PAD_FLAG_EOS); + + gst_object_unref (internal_pad); +} + static void switch_pads (GstHLSDemux * demux) { @@ -2146,6 +2171,9 @@ gst_hls_demux_get_next_fragment (GstHLSDemux * demux, NULL))); } + /* clear the ghostpad eos state */ + gst_hls_demux_stream_clear_eos_state (demux); + if (demux->last_ret != GST_FLOW_OK) return FALSE;