basesrc: avoid flush when starting

When we are doing the initial seek in startup, avoid doing a flush
(and unlock) because we know that the task is not started yet.
This commit is contained in:
Wim Taymans 2012-06-15 14:54:48 +02:00
parent 31e991271f
commit 1c60558d8c

View file

@ -1483,7 +1483,7 @@ not_ok:
* instead of EOS when doing a segment seek.
*/
static gboolean
gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event)
gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
{
gboolean res = TRUE, tres;
gdouble rate;
@ -1542,6 +1542,7 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event)
gst_pad_pause_task (src->srcpad);
/* unblock streaming thread. */
if (unlock)
gst_base_src_set_flushing (src, TRUE, FALSE, &playing);
/* grab streaming lock, this should eventually be possible, either
@ -1557,6 +1558,7 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event)
GST_DEBUG_OBJECT (src, "seek with seqnum %" G_GUINT32_FORMAT, seqnum);
}
if (unlock)
gst_base_src_set_flushing (src, FALSE, playing, NULL);
/* If we configured the seeksegment above, don't overwrite it now. Otherwise
@ -1772,7 +1774,7 @@ gst_base_src_send_event (GstElement * element, GstEvent * event)
GST_DEBUG_OBJECT (src, "performing seek");
/* when we are running in push mode, we can execute the
* seek right now. */
result = gst_base_src_perform_seek (src, event);
result = gst_base_src_perform_seek (src, event, TRUE);
} else {
GstEvent **event_p;
@ -1867,7 +1869,7 @@ gst_base_src_default_event (GstBaseSrc * src, GstEvent * event)
if (!gst_base_src_seekable (src))
goto not_seekable;
result = gst_base_src_perform_seek (src, event);
result = gst_base_src_perform_seek (src, event, TRUE);
break;
case GST_EVENT_FLUSH_START:
/* cancel any blocking getrange, is normally called
@ -3157,8 +3159,9 @@ gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret)
basesrc->pending_seek = NULL;
GST_OBJECT_UNLOCK (basesrc);
/* The perform seek code will start the task when finished. */
if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event)))
/* The perform seek code will start the task when finished. We don't have to
* unlock the streaming thread because it is not running yet */
if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event, FALSE)))
goto seek_failed;
if (event)
@ -3295,6 +3298,8 @@ gst_base_src_set_flushing (GstBaseSrc * basesrc,
bclass = GST_BASE_SRC_GET_CLASS (basesrc);
GST_DEBUG_OBJECT (basesrc, "flushing %d, live_play %d", flushing, live_play);
if (flushing) {
gst_base_src_activate_pool (basesrc, FALSE);
/* unlock any subclasses, we need to do this before grabbing the