diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index a692b6f99e..e171dc2f0f 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -2573,8 +2573,20 @@ gst_base_src_loop (GstPad * pad) src = GST_BASE_SRC (GST_OBJECT_PARENT (pad)); + /* Just leave immediately if we're flushing */ + GST_LIVE_LOCK (src); + if (G_UNLIKELY (src->priv->flushing || GST_PAD_IS_FLUSHING (pad))) + goto flushing; + GST_LIVE_UNLOCK (src); + gst_base_src_send_stream_start (src); + /* The stream-start event could've caused something to flush us */ + GST_LIVE_LOCK (src); + if (G_UNLIKELY (src->priv->flushing || GST_PAD_IS_FLUSHING (pad))) + goto flushing; + GST_LIVE_UNLOCK (src); + /* check if we need to renegotiate */ if (gst_pad_check_reconfigure (pad)) { if (!gst_base_src_negotiate (src)) { @@ -2588,7 +2600,7 @@ gst_base_src_loop (GstPad * pad) GST_LIVE_LOCK (src); - if (G_UNLIKELY (src->priv->flushing)) + if (G_UNLIKELY (src->priv->flushing || GST_PAD_IS_FLUSHING (pad))) goto flushing; blocksize = src->blocksize;