From 0fca02bb5e538f508e916e5a560366b2c0e2df82 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sat, 30 Jun 2018 00:56:29 +1000 Subject: [PATCH] webrtc: Move the transportsendbin pad block removal Move freeing of the pad blocks back to before we call the GstBin state change function, as there's something racy going on on the build server otherwise, where the pads don't unblock during downward state changes. This is a bit of a stab in the dark, since I can't recreate the build server failure locally. --- ext/webrtc/transportsendbin.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ext/webrtc/transportsendbin.c b/ext/webrtc/transportsendbin.c index 312456ed17..3a9b5c6317 100644 --- a/ext/webrtc/transportsendbin.c +++ b/ext/webrtc/transportsendbin.c @@ -221,21 +221,14 @@ transport_send_bin_change_state (GstElement * element, gst_object_unref (pad); break; } - default: - break; - } - - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - if (ret == GST_STATE_CHANGE_FAILURE) - return ret; - - /* Do downward state change cleanups after the element - * has been stopped, as this will have set pads to flushing as needed - * and unblocked any pad probes that are blocked */ - switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: { - /* Release pad blocks */ + /* Normally, we do downward state change cleanups after the element + * has been stopped, as this will have set pads to flushing as needed + * and unblocked any pad probes that are blocked, but sometimes that's + * causing a deadlock on the build server in tests, with a race around + * the pad blocking/release timing, so free the pad blocks before + * stopping everything */ if (send->rtp_block && send->rtp_block->block_id) { gst_pad_remove_probe (send->rtp_block->pad, send->rtp_block->block_id); send->rtp_block->block_id = 0; @@ -262,6 +255,15 @@ transport_send_bin_change_state (GstElement * element, } break; } + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + if (ret == GST_STATE_CHANGE_FAILURE) + return ret; + + switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL:{ GstElement *elem;