sctp: Ensure pad is still a child of element before removal
authorDoug Nazar <nazard@nazar.ca>
Tue, 18 May 2021 04:43:23 +0000 (00:43 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 19 May 2021 05:49:48 +0000 (05:49 +0000)
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>

ext/sctp/gstsctpenc.c

index 99a0e83..e420fe0 100644 (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