From f2478618b590a29ef65fda0e66ae2df804e67b5c Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 3 Jun 2020 08:09:04 +0200 Subject: [PATCH] inputselector: Avoid deadlock when requesting pads The deadlock was the following: * One thread requests a new pad, the internal lock is kept while adding the pad * Another thread (or the same one) requests the internal links of a pad (could be that pad)... which also requires that lock. That internal lock is not required when adding the pad to the element (which is the last action when requesting a new pad). The fact it will be actually used will be *after* the request pad function is released. Part-of: --- plugins/elements/gstinputselector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index 4eb06c430c..336ba16ae7 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c @@ -1813,8 +1813,8 @@ gst_input_selector_request_new_pad (GstElement * element, GST_OBJECT_FLAG_SET (sinkpad, GST_PAD_FLAG_PROXY_CAPS); GST_OBJECT_FLAG_SET (sinkpad, GST_PAD_FLAG_PROXY_ALLOCATION); gst_pad_set_active (sinkpad, TRUE); - gst_element_add_pad (GST_ELEMENT (sel), sinkpad); GST_INPUT_SELECTOR_UNLOCK (sel); + gst_element_add_pad (GST_ELEMENT (sel), sinkpad); return sinkpad; }