[gst-devel] [PATCH] checks in gst_pad_connect()

Andy Wingo wingo at pobox.com
Wed Jan 16 19:52:02 CET 2002


On Wed, 16 Jan 2002, Andy Wingo wrote:

ok, so i have to allow sched to be NULL in the case of bins that are
constructed and then put in the element. so instead i do:


if (realsrc->sched && realsink->sched)
  do the the sched/decoupled test
else if (realsrc->sched || realsink->sched)
  you shouldn't be allowed to do this imo
else
  ok, you don't have a sched yet, we let you through

this was the old diff, for reference:

> diff -u -r1.135 gstpad.c
> +++ gstpad.c	2002/01/17 03:25:58
> @@ -587,6 +587,7 @@
>  {
>    GstRealPad *realsrc, *realsink;
>    gboolean negotiated = FALSE;
> +  gint num_decoupled = 0;
>  
>    /* generic checks */
>    g_return_val_if_fail (srcpad != NULL, FALSE);
> @@ -607,6 +608,22 @@
>  
>    g_return_val_if_fail (GST_RPAD_PEER (realsrc) == NULL, FALSE);
>    g_return_val_if_fail (GST_RPAD_PEER (realsink) == NULL, FALSE);
> +  g_return_val_if_fail (GST_PAD_PARENT (realsrc) != NULL, FALSE);
> +  g_return_val_if_fail (GST_PAD_PARENT (realsink) != NULL, FALSE);
> +  g_return_val_if_fail (realsrc->sched && realsink->sched, FALSE);
> +
> +  if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsrc), GST_ELEMENT_DECOUPLED))
> +    num_decoupled++;
> +  if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsink), GST_ELEMENT_DECOUPLED))
> +    num_decoupled++;
> +
> +  if (realsrc->sched == realsink->sched && num_decoupled != 0) {
> +    g_warning ("cannot connect pads from decoupled elements with the same sched\n");
> +    return FALSE;
> +  } else if (realsrc->sched != realsink->sched && num_decoupled != 1) {
> +    g_warning ("connecting pads with different scheds requires one decoupled element (queue)\n");
> +    return FALSE;
> +  }
>  






More information about the gstreamer-devel mailing list