element: Add sanity check with a critical warning if a pad is requested for a pad...
authorSebastian Dröge <sebastian@centricular.com>
Thu, 12 May 2022 17:15:44 +0000 (20:15 +0300)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 12 May 2022 17:29:26 +0000 (17:29 +0000)
commitfbf0cc2279e9a9ccb44aecce4cd7e36feaacf810
tree7bf0ebb9704d68c7848a61ea3f29872633293692
parentaa3b6a11e076b609163b7454bea990e65cb5a9e7
element: Add sanity check with a critical warning if a pad is requested for a pad template that is not installed on the element class

Various elements are assuming that the pointer matches a pad template
they know about, and also randomly created pad templates might be
missing some important information that is necessary to create a valid
pad.

For example, creating a new pad template for audiomixer's sinkpad
without providing the correct GType would cause audiomixer to create a
GstAggregatorPad. That will then later fail spectacularly because it
assumes that it got a GstAudioAggregatorPad.

Passing a pad template that does not belong to the element class in here
will easily lead to undefined behaviour.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2410>
subprojects/gstreamer/gst/gstelement.c