From e444ffecf7568b6f9d23dae3dcef638674fe5661 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 29 Dec 2010 11:48:18 +0100 Subject: [PATCH] basesrc: fix deadlock Only go into LIVE_WAIT when the are not live_running and only stop waiting when live_running is TRUE. If we don't loop, we could deadlock when called from outside of basesrc, such as baseaudiosrc. Fixes #635785 --- libs/gst/base/gstbasesrc.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 96fe5ddc80..bad49784ac 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -490,13 +490,14 @@ gst_base_src_wait_playing (GstBaseSrc * src) { g_return_val_if_fail (GST_IS_BASE_SRC (src), GST_FLOW_ERROR); - /* block until the state changes, or we get a flush, or something */ - GST_DEBUG_OBJECT (src, "live source waiting for running state"); - GST_LIVE_WAIT (src); - if (src->priv->flushing) - goto flushing; - GST_DEBUG_OBJECT (src, "live source unlocked"); - + while (G_UNLIKELY (!src->live_running)) { + /* block until the state changes, or we get a flush, or something */ + GST_DEBUG_OBJECT (src, "live source waiting for running state"); + GST_LIVE_WAIT (src); + GST_DEBUG_OBJECT (src, "live source unlocked"); + if (src->priv->flushing) + goto flushing; + } return GST_FLOW_OK; /* ERRORS */ @@ -2096,7 +2097,7 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length, again: if (src->is_live) { - while (G_UNLIKELY (!src->live_running)) { + if (G_UNLIKELY (!src->live_running)) { ret = gst_base_src_wait_playing (src); if (ret != GST_FLOW_OK) goto stopped;