Apply the changes of the commits c80132e4a3 and 23261bccbb Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5032>
c80132e4a3
23261bccbb