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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3381>
This commit is contained in:
Matthew Waters 2022-11-10 14:22:30 +11:00 committed by GStreamer Marge Bot
parent b010f00d36
commit a34e380e2e

View file

@ -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);