<meta http-equiv="Content-Type" content="text/html; charset=GB18030"><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>From: </b> "Nicolas Dufresne";<nicolas@ndufresne.ca>;</div><div><b>Date: </b> May 7, 2022</div><div><b>To: </b> "Discussion of the development of and with GStreamer"<gstreamer-devel@lists.freedesktop.org>; <wbr></div><div><b>Cc: </b> "neoragex2002"<neoragex2002@qq.com>; <wbr></div><div><b>Subject: </b> Re: Understanding about the 'tee' element</div></div><div><br></div><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 7 mai 2022, 05 h 45, neoragex2002 via gstreamer-devel <<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey all,<br><br>Recently I'm learning about how to use 'tee' and found things really weird.<br><br>What I'm doing is below:<br><br>```bash<br>$ gst-launch-1.0 videotestsrc pattern=18 ! 'video/x-raw, width=1920, height=1080' ! \<br>    tee name=t \<br>    t. ! queue ! videoconvert ! fpsdisplaysink sync=false \<br>    t. ! queue ! videoconvert ! fpsdisplaysink name=sink0 sync=false<br>````<br><br>A probe function of gst-python was also been written to to hook the 'sink' pad of sink0 in the 2nd tee-branch.<br>As you can see the probe function was very simple. It just slept for random msec.<br><br>```python<br>import random<br><br>def probe_func(pad, info):<br>    delay = random.randint(0,2)<br>    GLib.usleep(delay*200000) # 200ms x delay<br>    return Gst.PadProbeReturn.OK<br>````<br><br>But I found things are going weird: the display of the 1st tee-branch was frequently choked because of the random sleeps in the 2nd tee-branch.<br>It seems that the queue in 2nd tee-branch was totally USELESS to decouple the running of the two branches.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">> The Python interpreter is single threaded, as a side effect the probes are being serialized. Don't use python if you need to interact with multiple streaming threads.</div><div dir="auto"><br></div><div dir="auto">That is one of good points. Thanks for your mention! But what I concerned here is not the GIL of python, because there is no computing-bound python probe in the 1st tee-branch. <br></div><div dir="auto">According to the docs of gstreamer, the queue-seperated 1st tee-branch and 2nd tee-branch are belong to different streaming threads. Their runnings should not be dependent with each other right?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>All I want is an 'independent enough' behavior of the 2nd tee-branch that does not block the 1st branch. and I also want my probe func could <br>read EVERY frame AT ITS OWN PACE, instead of DISCARDING some frames to catch up the pace of 1st branch by using `queue leaky=2 max-size-buffers=1' <br>in the 2nd tee-branch.<br><br>Can anyone kindly enough to explain this for me?<br><br>Thanks in advance,<br><br>Rio<br></blockquote></div></div></div></div>