inputselector: Need flush when set active pad and then seek in PAUSE state https://bugzilla.gnome.org/show_bug.cgi?id=782417 Upstream Status: Pending. Signed-off-by: Song Bing bing.song@nxp.com
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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 ());