From a34e380e2ed6ae5d35611169a74c0deb61be4739 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 10 Nov 2022 14:22:30 +1100 Subject: [PATCH] sctpdec: fix stream reset (src pad removal) if no data is ever received If we don't receive any data from usrsctp, then there will be no src pad for the stream id and the stream reset will fail to remove the relevant src pad. Workaround by first attempting to add the relevant src pad, then almost immediately removing it. Part-of: --- subprojects/gst-plugins-bad/ext/sctp/gstsctpdec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/sctp/gstsctpdec.c b/subprojects/gst-plugins-bad/ext/sctp/gstsctpdec.c index 097b629..a90f894 100644 --- a/subprojects/gst-plugins-bad/ext/sctp/gstsctpdec.c +++ b/subprojects/gst-plugins-bad/ext/sctp/gstsctpdec.c @@ -629,8 +629,14 @@ on_gst_sctp_association_stream_reset (GstSctpAssociation * gst_sctp_association, srcpad = gst_element_get_static_pad (GST_ELEMENT (self), pad_name); g_free (pad_name); if (!srcpad) { - GST_WARNING_OBJECT (self, "Reset called on stream without a srcpad"); - return; + /* This can happen if a stream is created but the peer never sends any data. + * We still need to signal the reset by removing the relevant pad. To do + * that, we need to add the relevant pad first. */ + srcpad = get_pad_for_stream_id (self, stream_id); + if (!srcpad) { + GST_WARNING_OBJECT (self, "Reset called on stream without a srcpad"); + return; + } } remove_pad (self, srcpad); gst_object_unref (srcpad); -- 2.7.4