From ba6d3b5aca488f37c47f2b44f60db3fa1d2ffa8c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 16 Mar 2009 16:16:30 +0100 Subject: [PATCH] playbin2: release the shutdown lock Release the shutdown lock when we wait for other groups to complete or else we have a deadlock when the other group completes and tries to grab the shutdown lock. Fixes #575550. --- gst/playback/gstplaybin2.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index cd6a27683e..e04aae6e2e 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -1959,8 +1959,13 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group) while (group->pending) { GST_DEBUG_OBJECT (playbin, "%d pending in group %p, waiting", group->pending, group); + + GST_PLAY_BIN_SHUTDOWN_UNLOCK (playbin); + /* FIXME, unlock when shutting down */ GST_SOURCE_GROUP_WAIT (group); + + GST_PLAY_BIN_SHUTDOWN_LOCK (playbin, shutdown2); } } GST_SOURCE_GROUP_UNLOCK (group); @@ -1992,6 +1997,11 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group) return; +shutdown2: + { + GST_SOURCE_GROUP_UNLOCK (group); + goto shutdown; + } shutdown: { GST_DEBUG ("ignoring, we are shutting down"); @@ -2498,6 +2508,7 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition) /* FIXME unlock our waiting groups */ GST_LOG_OBJECT (playbin, "setting shutdown flag"); g_atomic_int_set (&playbin->shutdown, 1); + /* wait for all callbacks to end by taking the lock. * No dynamic (critical) new callbacks will * be able to happen as we set the shutdown flag. */