From 44811ab65047f8b2349c23bfd7e1cc15a482da3d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 14 Aug 2013 17:44:48 +0200 Subject: [PATCH] basesrc: improve flush-start handling Use custom code to implement flush-stop, we can't reuse the set_flushing code because we can't touch the live_playing flag and we need to signal the streaming thread. --- libs/gst/base/gstbasesrc.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index ce92d00..ccc5b0b 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -1711,7 +1711,26 @@ gst_base_src_send_event (GstElement * element, GstEvent * event) GST_DEBUG_OBJECT (src, "pushing flush-start event downstream"); result = gst_pad_push_event (src->srcpad, event); /* also unblock the create function */ - gst_base_src_set_flushing (src, TRUE, FALSE, NULL); + gst_base_src_activate_pool (src, FALSE); + /* unlock any subclasses, we need to do this before grabbing the + * LIVE_LOCK since we hold this lock before going into ::create. We pass an + * unlock to the params because of backwards compat (see seek handler)*/ + if (bclass->unlock) + bclass->unlock (src); + + /* the live lock is released when we are blocked, waiting for playing or + * when we sync to the clock. */ + GST_LIVE_LOCK (src); + src->priv->flushing = TRUE; + /* clear pending EOS if any */ + g_atomic_int_set (&src->priv->pending_eos, FALSE); + if (bclass->unlock_stop) + bclass->unlock_stop (src); + if (src->clock_id) + gst_clock_id_unschedule (src->clock_id); + GST_DEBUG_OBJECT (src, "signal"); + GST_LIVE_SIGNAL (src); + GST_LIVE_UNLOCK (src); event = NULL; break; case GST_EVENT_FLUSH_STOP: @@ -1732,8 +1751,6 @@ gst_base_src_send_event (GstElement * element, GstEvent * event) if (start) gst_pad_start_task (src->srcpad, (GstTaskFunction) gst_base_src_loop, src->srcpad, NULL); - GST_DEBUG_OBJECT (src, "signal"); - GST_LIVE_SIGNAL (src); GST_LIVE_UNLOCK (src); event = NULL; break; -- 2.7.4