Copied from https://gitlab.freedesktop.org//gstreamer/gst-plugins-base/-/merge_requests/1168
Superset of gstreamer/gst-plugins-base!1161 (closed)