From 9860e95c4c6bcec422b6c83a2650ef76dd6a5488 Mon Sep 17 00:00:00 2001 From: Song Bing Date: Wed, 10 May 2017 11:24:46 +0800 Subject: [PATCH 7/7] inputselector: Need flush when set active pad and then seek in PAUSE state Upstream-Status: Pending [https://bugzilla.gnome.org/show_bug.cgi?id=782417] Signed-off-by: Song Bing bing.song@nxp.com --- plugins/elements/gstinputselector.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index f6e1993..54400dd 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c @@ -161,6 +161,7 @@ struct _GstSelectorPad guint32 segment_seqnum; /* sequence number of the current segment */ gboolean events_pending; /* TRUE if sticky events need to be updated */ + gboolean flush_events_pending;/* unblock old active track */ gboolean sending_cached_buffers; GQueue *cached_buffers; @@ -339,6 +340,7 @@ gst_selector_pad_reset (GstSelectorPad * pad) pad->eos = FALSE; pad->eos_sent = FALSE; pad->events_pending = FALSE; + pad->flush_events_pending = FALSE; pad->discont = FALSE; pad->flushing = FALSE; gst_segment_init (&pad->segment, GST_FORMAT_UNDEFINED); @@ -557,6 +559,8 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event) selpad->flushing = TRUE; sel->eos = FALSE; selpad->group_done = FALSE; + if (selpad->flush_events_pending) + forward = TRUE; GST_INPUT_SELECTOR_BROADCAST (sel); break; case GST_EVENT_FLUSH_STOP: @@ -1136,6 +1140,7 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) buf = gst_buffer_ref (buf); res = gst_pad_push (sel->srcpad, buf); GST_LOG_OBJECT (pad, "Buffer %p forwarded result=%d", buf, res); + selpad->flush_events_pending = FALSE; GST_INPUT_SELECTOR_LOCK (sel); @@ -1389,8 +1394,12 @@ gst_input_selector_set_active_pad (GstInputSelector * self, GstPad * pad) active_pad_p = &self->active_sinkpad; gst_object_replace ((GstObject **) active_pad_p, GST_OBJECT_CAST (pad)); - if (old && old != new) + if (old && old != new) { gst_pad_push_event (GST_PAD_CAST (old), gst_event_new_reconfigure ()); + /* Old will be blocked on gst_pad_push() when set active pad in PAUSE + * state. Need flush when set active pad and then seek in PAUSE state */ + old->flush_events_pending = TRUE; + } if (new) gst_pad_push_event (GST_PAD_CAST (new), gst_event_new_reconfigure ()); -- 1.9.1