sctp: Ensure pad is still a child of element before removal

During pipeline shutdown there are several competing paths to remove
pads. Avoids tests failing due to:

Unexpected critical/warning: Padname '':sink_1 does not belong to element sctpenc1 when removing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2256>
This commit is contained in:
Doug Nazar 2021-05-18 00:43:23 -04:00 committed by GStreamer Marge Bot
parent 5663db236f
commit be1c154f33

View file

@ -483,7 +483,10 @@ gst_sctp_enc_release_pad (GstElement * element, GstPad * pad)
if (self->sctp_association)
gst_sctp_association_reset_stream (self->sctp_association, stream_id);
gst_element_remove_pad (element, pad);
GST_PAD_STREAM_LOCK (pad);
if (gst_object_has_as_parent (GST_OBJECT (pad), GST_OBJECT (element)))
gst_element_remove_pad (element, pad);
GST_PAD_STREAM_UNLOCK (pad);
}
static void