From: Jan Alexander Steffens (heftig) Date: Tue, 26 Jan 2021 15:33:25 +0000 (+0100) Subject: splitmuxsink: Avoid deadlock on release, harder X-Git-Tag: 1.22.0~1628 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd27ee15374c266097902cfd4386f73f406c204e;p=platform%2Fupstream%2Fgstreamer.git splitmuxsink: Avoid deadlock on release, harder Unlock after broadcasting and wait for the pad to be free before relocking the muxer, giving the input probe a chance to react to our broadcast. Improves the fix from https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/838. Part-of: --- diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c index 1846f42..e517800 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c @@ -3576,6 +3576,9 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad) /* Remove the context from our consideration */ splitmux->contexts = g_list_remove (splitmux->contexts, ctx); + ctx->is_releasing = TRUE; + GST_SPLITMUX_BROADCAST_INPUT (splitmux); + GST_SPLITMUX_UNLOCK (splitmux); if (ctx->sink_pad_block_id) { @@ -3586,10 +3589,10 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad) if (ctx->src_pad_block_id) gst_pad_remove_probe (ctx->srcpad, ctx->src_pad_block_id); + /* Wait for the pad to be free */ + GST_PAD_STREAM_LOCK (pad); GST_SPLITMUX_LOCK (splitmux); - - ctx->is_releasing = TRUE; - GST_SPLITMUX_BROADCAST_INPUT (splitmux); + GST_PAD_STREAM_UNLOCK (pad); /* Can release the context now */ mq_stream_ctx_free (ctx);