From 01ccac24fa1f69687c42e9ae7b7148174040007b Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 17 Sep 2014 17:27:53 -0300 Subject: [PATCH] mssdemux: 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/smoothstreaming/gstmssdemux.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ext/smoothstreaming/gstmssdemux.c b/ext/smoothstreaming/gstmssdemux.c index e7c4fe6c03..70b6255d7f 100644 --- a/ext/smoothstreaming/gstmssdemux.c +++ b/ext/smoothstreaming/gstmssdemux.c @@ -1207,6 +1207,31 @@ _src_query (GstPad * pad, GstObject * parent, GstQuery * query) return gst_pad_query_default (pad, parent, query); } +static gboolean +_mss_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_mss_demux_stream_clear_eos_state (GstMssDemuxStream * stream) +{ + GstPad *internal_pad; + + internal_pad = + GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (stream->pad))); + gst_pad_sticky_events_foreach (internal_pad, + _mss_demux_pad_remove_eos_sticky, NULL); + GST_OBJECT_FLAG_UNSET (internal_pad, GST_PAD_FLAG_EOS); + + gst_object_unref (internal_pad); +} + static gboolean gst_mss_demux_stream_update_source (GstMssDemuxStream * stream, const gchar * uri, const gchar * referer, gboolean refresh, @@ -1360,8 +1385,8 @@ gst_mss_demux_stream_download_uri (GstMssDemux * demux, /* flush the proxypads so that the EOS state is reset */ gst_pad_push_event (stream->src_srcpad, gst_event_new_flush_start ()); gst_pad_push_event (stream->src_srcpad, gst_event_new_flush_stop (TRUE)); - gst_element_set_state (stream->src, GST_STATE_READY); + gst_mss_demux_stream_clear_eos_state (stream); } static GstFlowReturn