srtpdec: fix assertion 'parent->numsinkpads <= 1' failed

A race condition can occur in `srtpdec` during the READY -> NULL transition:
an RTCP buffer can make its way to `gst_srtp_dec_chain` while the element is
partially stopped, resulting in the following critical warning:

> assertion 'parent->numsinkpads <= 1' failed

This can occur when the first RTCP buffer is received during the READY -> NULL
transition. If deactivation of the `rtp_srcpad` has already reached
`post_activate`, the sticky events are removed from this Pad. In this case,
`gst_srtp_dec_push_early_events` branches to the generation of a stream id
using `gst_pad_create_stream_id`. This function ensures that the element
doesn't own more than 1 sink pad. Since `srtpdec` owns two of them, the
assertion fails.

This commit uses `gst_element_decorate_stream_id` which doesn't perform this
check. The preconditions is not necessary in this particular context since the
stream id for the RTP / RTCP pads are derived from the same id.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4844>
This commit is contained in:
François Laignel 2023-06-12 11:05:34 +02:00 committed by GStreamer Marge Bot
parent 308a9f9466
commit 96450f4c59

View file

@ -1283,7 +1283,7 @@ gst_srtp_dec_push_early_events (GstSrtpDec * filter, GstPad * pad,
is_rtcp ? "rtcp" : "rtp");
gst_event_unref (otherev);
} else {
new_stream_id = gst_pad_create_stream_id (pad, GST_ELEMENT (filter),
new_stream_id = gst_element_decorate_stream_id (GST_ELEMENT (filter),
is_rtcp ? "rtcp" : "rtp");
}