In my experience, the bin/elements/branch you&#39;re trying to attach to one of the src%d pads should be in the PLAYING state before you link it.  This is because as the tee tries to push a buffer to its src pads, if any of the pads is linked to a non-PLAYING element, the buffer push method returrn a wrong-state value which propagates all the way to the source and pauses everything, GST_DEBUG=4 will show you this.<div>
<br></div><div>Also, like you mentioned, gst_pad_link is how you would link a tee&#39;s src%d to the branch.</div><div><br></div><div>While unlinking, I first unlink the pad and then take care of the disposing the branch.  Ideally, however, we should block data on the pad and then unlink it, but that hasn&#39;t work for me so far.</div>
<div><br></div><div>HTH<br><br><div class="gmail_quote">On Fri, Nov 6, 2009 at 8:37 AM, Peter Cai <span dir="ltr">&lt;<a href="mailto:newptcai@gmail.com">newptcai@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
After a lot of search, I found this is not quite simple as I used to<br>
think.  The coding following only work when 2 sink is linked to the<br>
tee.<br>
When the 3rd comes, all 3 sink doesn&#39;t work.<br>
<br>
What is the correct way to add and remove branch to a &quot;tee&quot;?<br>
On IRC, I was told to try these<br>
<br>
1. setting sink &quot;asycn = FALSE&quot;<br>
2. add a queue between tee and sink<br>
3. use pad instead of gst_element_link<br>
<br>
None of them works.<br>
<br>
        GstElement* dd = gst_element_factory_make(&quot;directdrawsink&quot;, NULL);<br>
        g_object_set(dd, &quot;async&quot;, FALSE, NULL);<br>
        gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(dd), (gulong)handle);<br>
<br>
        gst_element_set_state (dd, GST_STATE_PAUSED);<br>
        gst_bin_add(GST_BIN (self-&gt;priv-&gt;pipeline), dd);<br>
<br>
        if(!gst_element_link (self-&gt;priv-&gt;tee, dd))<br>
        {<br>
            vivs_warning(&quot;Can not link tee to directdrawsink&quot;);<br>
        }<br>
<br>
        if(self-&gt;priv-&gt;sink_num == 1)<br>
            gst_element_set_state (self-&gt;priv-&gt;pipeline, GST_STATE_PLAYING);<br>
        else<br>
            gst_element_set_state (dd, GST_STATE_PLAYING);<br>
      self-&gt;priv-&gt;sink_num += 1<br>
<br>
<br>
--<br>
look to the things around you,the immediate world around you, if you<br>
are alive,it will mean something to you ——Paul Strand<br>
<br>
------------------------------------------------------------------------------<br>
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day<br>
trial. Simplify your report design, integration and deployment - and focus on<br>
what you do best, core application coding. Discover what&#39;s new with<br>
Crystal Reports now.  <a href="http://p.sf.net/sfu/bobj-july" target="_blank">http://p.sf.net/sfu/bobj-july</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</blockquote></div><br></div>