summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2018-06-27 03:05:55 +1000
committerJan Schmidt <jan@centricular.com>2018-06-28 00:25:18 +1000
commit798a5d42ab09262af101dbd58c9eb57d59b4736d (patch)
tree7adf2fc1fcbcccf4dc70f245f1ae08e510915f28
parent6ddf178f579311a476a7ddf56f2f376079ba9f23 (diff)
downloadgstreamer-plugins-bad-798a5d42ab09262af101dbd58c9eb57d59b4736d.tar.gz
webrtc: Don't deadlock on block pads on shutdown
When changing state downward, we can't set pads to inactive if they are blocked, it will deadlock trying to acquire the streaming lock. Just calling the parent state change function will do the correct things to unblock probes and set the pad inactive, so let it do that and remove the probes after the parent state change function has run https://bugzilla.gnome.org/show_bug.cgi?id=796682
-rw-r--r--ext/webrtc/transportsendbin.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ext/webrtc/transportsendbin.c b/ext/webrtc/transportsendbin.c
index 8acb74025..67f1c9a72 100644
--- a/ext/webrtc/transportsendbin.c
+++ b/ext/webrtc/transportsendbin.c
@@ -219,34 +219,41 @@ 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 */
if (send->rtp_block && send->rtp_block->block_id) {
- gst_pad_set_active (send->rtp_block->pad, FALSE);
gst_pad_remove_probe (send->rtp_block->pad, send->rtp_block->block_id);
send->rtp_block->block_id = 0;
}
if (send->rtcp_mux_block && send->rtcp_mux_block->block_id) {
- gst_pad_set_active (send->rtcp_mux_block->pad, FALSE);
gst_pad_remove_probe (send->rtcp_mux_block->pad,
send->rtcp_mux_block->block_id);
send->rtcp_mux_block->block_id = 0;
}
if (send->rtcp_block && send->rtcp_block->block_id) {
- gst_pad_set_active (send->rtcp_block->pad, FALSE);
gst_pad_remove_probe (send->rtcp_block->pad,
send->rtcp_block->block_id);
send->rtcp_block->block_id = 0;
}
if (send->rtp_nice_block && send->rtp_nice_block->block_id) {
- gst_pad_set_active (send->rtp_nice_block->pad, FALSE);
gst_pad_remove_probe (send->rtp_nice_block->pad,
send->rtp_nice_block->block_id);
send->rtp_nice_block->block_id = 0;
}
if (send->rtcp_nice_block && send->rtcp_nice_block->block_id) {
- gst_pad_set_active (send->rtcp_nice_block->pad, FALSE);
gst_pad_remove_probe (send->rtcp_nice_block->pad,
send->rtcp_nice_block->block_id);
send->rtcp_nice_block->block_id = 0;
@@ -283,7 +290,6 @@ transport_send_bin_change_state (GstElement * element,
break;
}
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return ret;
}