WRONG_HIERARCHY when both elements are in the same Pipeline

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

WRONG_HIERARCHY when both elements are in the same Pipeline

jimfcarroll
This post was updated on .
When I try to link pads I'm getting WRONG_HIERARCHY even though if I traverse
up the parents for both pads, I get to the same Pipeline. Are there
conditions under which this can happen?

My Pipeline has

    rtpsource -> tee -> Q -> rtpbin session 0 ...


While the pipeline is running I request a request pad from the tee. I
connect it to a filter and the out of the filter becomes the next session on
the rtpbin.

    rtpsource -> tee -> Q ---------> rtpbin session 0 ...
                          |                  
                          ->  Q -> filter -> rtpbin session 1 ...
<

The Q and filter (and decoder, etc) are wrapped in a Bin. At the point I
connect the Bin containing the Q and the filter, that Bin, as well as the
tee are part of the pipeline. I can traverse the parent links to the
pipeline before calling link. Yet, I get a WRONG_HIERARCHY return value
trying to link the tee's request src pad with the Bin's sink pad.

Does anyone have any suggestions?

Thanks
Jim





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WRONG_HIERARCHY when both elements are in the same Pipeline

jimfcarroll
Some additional information. The program is in Java and the following code is
inserted to demonstrate my the condition:

           final Pad teePad = tee.getRequestPad("src_2");
           System.out.println(pipe.element.add(tee));
           final Pad sinkPad = inputStreamBin.getSinkPads().get(0);
           System.out.println(teePad.getName());
           System.out.println(teePad.getParent().getName());
           System.out.println(teePad.getParent().getParent().getName());
         
System.out.println(teePad.getParent().getParent().getParent().getName());
           System.out.println(sinkPad.getName());
           System.out.println(sinkPad.getParent().getName());
           System.out.println(sinkPad.getParent().getParent().getName());
           System.out.println(teePad.link(sinkPad));

It produces:

src_2
tee8
vsrc_0
pipeline0
GstSink:sink
vsrc_1
pipeline0
WRONG_HIERARCHY

Notice, pad src_2 is part of element tee8, which is part of bin vsrc_0 which
is in pipeline0. Also, sinkPad is GstSink:sink which is a ghostpad of bin
vsrc_1 whose parent is ALSO pipeline0. YET the link produces a
"WRONG_HIERARCHY."




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WRONG_HIERARCHY when both elements are in the same Pipeline

Baby Octopus
Administrator
See if you can generate DOT diagram and check the pipeline. Most likely you
have issue in pipeline creation, may be multiple elements created with same
name, or something similar



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WRONG_HIERARCHY when both elements are in the same Pipeline

jimfcarroll
Thanks.

The problem is GStreamer (or, my expectations). This is from gstpad.c:


Baby Octopus wrote

>   /* if the parents are the same, we have a loop */
>   if (G_UNLIKELY (psrc == psink))
>     goto same_parents;
>
>   /* if they both have a parent, we check the grandparents. We can not
> lock
>    * the parent because we hold on the child (pad) and the locking order
> is
>    * parent >> child. */
>   psrc = GST_OBJECT_PARENT (psrc);
>   psink = GST_OBJECT_PARENT (psink);
>
>   /* if they have grandparents but they are not the same */
>   if (G_UNLIKELY (psrc != psink))
>     goto wrong_grandparents;

IOW. The parents need to match exactly, or the grandparents need to match
exactly. PERIOD. It can't be that the parent of one matches the grandparent
of the other, or simply that they have a common ancestor (which is what I
expected). In my case, as you can see from the output, the GREAT-grandparent
of one is the pipeline and the grandparent of the other is the pipeline.

Is there a reason for this other than the code above? Is there an
expectation in other places in the code that:

1) linked pads are on the same level of the Bin hierarchy
2) we only check up 2 levels for commonality

Thanks.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WRONG_HIERARCHY when both elements are in the same Pipeline

jimfcarroll
Actually, I misread that slightly. The parent of the pad is the element the
pad is on. If they are the same then there's a loop and that's an error
condition. In order for pad's to be linked the parents of the elements the
pad is on MUST be a common Bin.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WRONG_HIERARCHY when both elements are in the same Pipeline

Baby Octopus
Administrator
It is mandatory to have elements in same bin(or pipeline) when you are
linking them

~BO



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WRONG_HIERARCHY when both elements are in the same Pipeline

jimfcarroll
The problem is, "in the same bin" is ambiguous. They WERE both in the same bin. It's just that that common bin was the great grandparent of one of the pads, and the grandparent of the other. Not only do they need to be in the same bin, but that common bin MUST be exactly the parent of the element that the pad is on for both pads. 

I guess that makes sense though. Otherwise it would be more complicated.

On Sun, May 6, 2018 at 2:14 AM, Baby Octopus <[hidden email]> wrote:
It is mandatory to have elements in same bin(or pipeline) when you are
linking them

~BO



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel