Catch users wrongly setting foreign pads or wrong pads as
the selector's active pad, which leads to all kinds of
other issues. It's a programming error so handle it just
like we would if we had direct API.
https://bugzilla.gnome.org/show_bug.cgi?id=795309
if (pad == self->active_sinkpad)
return FALSE;
+ /* guard against users setting a src pad or foreign pad as active pad */
+ if (pad != NULL) {
+ g_return_val_if_fail (GST_PAD_IS_SINK (pad), FALSE);
+ g_return_val_if_fail (GST_IS_SELECTOR_PAD (pad), FALSE);
+ g_return_val_if_fail (GST_PAD_PARENT (pad) == GST_ELEMENT_CAST (self),
+ FALSE);
+ }
+
old = GST_SELECTOR_PAD_CAST (self->active_sinkpad);
new = GST_SELECTOR_PAD_CAST (pad);
GST_INFO_OBJECT (sel, "Activating pad %s:%s",
GST_DEBUG_PAD_NAME (next_pad));
+ /* guard against users setting a sink pad or foreign pad as active pad */
+ if (next_pad != NULL) {
+ g_return_if_fail (GST_PAD_IS_SRC (next_pad));
+ g_return_if_fail (GST_PAD_PARENT (next_pad) == GST_ELEMENT_CAST (sel));
+ }
+
GST_OBJECT_LOCK (object);
if (next_pad != sel->active_srcpad) {
/* switch to new srcpad in next chain run */