<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 18 févr. 2020 10 h 45, Wolfgang Grandegger <<a href="mailto:wg@grandegger.com">wg@grandegger.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
still hunting latency! When I use "vaapisink sync=false" the latency<br>
drops from 130 ms to 60 ms. There seem to be a kind of backlog<br>
somewhere. Any idea how that could happen or be avoided. Is there a<br>
tracer showing buffer/queue usage?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I would investigated why the depaylaoder reports that 80ms. For this use case, you should use the fast start on the JB too, it should remove the 100ms start-up latency, and most likely drops at start.</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>
Thanks,<br>
<br>
Wolfgang<br>
<br>
Am 09.02.20 um 19:07 schrieb Wolfgang Grandegger:<br>
> Hello,<br>
> <br>
> thanks for your valuable input...<br>
> <br>
> Am 07.02.20 um 14:01 schrieb Nicolas Dufresne:<br>
>> On ven, 2020-02-07 at 12:26 +0100, Wolfgang Grandegger wrote:<br>
>>> Hello,<br>
>>><br>
>>> I'm trying to understand the latency figures measured with a smartphone<br>
>>> and camera for the following pipeline:<br>
>>><br>
>>>   # gst-launch-1.0 -v udpsrc port=5678 buffer-size=2000000 do-timestamp=1 \<br>
>>>      caps="application/x-rtp, media=(string)video, clock-rate=(int)90000,<br>
>>> encoding-name=(string)JPEG, payload=(int)26, framerate=(fraction)30/1" \<br>
>>>      ! rtpjitterbuffer latency=5 \<br>
>>>      ! rtpjpegdepay \<br>
>>>      ! vaapijpegdec \<br>
>>>      ! vaapisink<br>
>>><br>
>>> I measure around 130 ms. The latency trace with "GST_TRACERS=latency<br>
>><br>
>> What method to you use to measure this ?<br>
> <br>
> I put my Android smartphone close to the display. On the smartphone I<br>
> start the clock app and start the timer. Then I place the camera in<br>
> front, recording both, the smartphone screen and the display. Then I<br>
> take a picture with my compact camera and compare the times shown on<br>
> the picture. I think that's what you name "glass to glass" latency.<br>
> <br>
>>> GST_DEBUG=GST_TRACER:7" is reporting src to sink latencies of just<br>
>>> around 40 ms:<br>
>><br>
>> You should look at the reported latency, maybe we are reporting too much. For<br>
>> this do:<br>
>><br>
>>   GST_TRACERS="latency\(flags=pipeline,element,reported\)"<br>
> Hm, what does "GST_TRACERS="latency" report? I think for the "flags=" I<br>
> need 1.6.x, IIRC.<br>
> <br>
>> To view the results, I suggest using gst-stats-1.0 tool form the latency logs<br>
>> saved to filed.<br>
>><br>
>>   pipeline ... 2> trace.log<br>
>>   gst-stats-1.0 trace.log<br>
> <br>
> OK, here is what I get. I have added some comments/questions with (*):<br>
> <br>
>   # gst-stats-1.0 /tmp/trace.log<br>
> <br>
>   Overall Statistics:<br>
>   Number of Threads: 0<br>
>   Number of Elements: 0<br>
>   Number of Bins: 0<br>
>   Number of Pads: 0<br>
>   Number of GhostPads: 0<br>
>   Number of Buffers passed: 0<br>
>   Number of Events sent: 0<br>
>   Number of Message sent: 0<br>
>   Number of Queries sent: 0<br>
> <br>
> (*) Shouldn't the numbers above show some real values?<br>
> <br>
>   Time: 0:05:54.100866710<br>
> <br>
>   Latency Statistics:<br>
>       0x4ef650.udpsrc0.src|0x5193a0.vaapisink0.sink: mean=43415981 min=38730503 max=108822660<br>
> <br>
> (*) The 43 ms seem to be the src to sink latency similar to what<br>
>     "GST_TRACERS=latency" reports.<br>
> <br>
>   Element Latency Statistics:<br>
>       0x4f5db0.rtpjitterbuffer0.src: mean=54507945 min=21104 max=107217916<br>
> <br>
> (*) Why is the rtpjitterbuffer responsible for most of the latency?<br>
> <br>
>       0x503fc0.rtpjpegdepay0.src: mean=340660 min=85865 max=655983<br>
>       0x51eba0.vaapidecode_jpeg0.src: mean=1123497 min=282112 max=108139722<br>
> <br>
>   Element Reported Latency:<br>
>       0x4ef650.udpsrc0: min=0 max=0 ts=0:00:00.183949148<br>
>       0x4f5db0.rtpjitterbuffer0: min=5000000 max=18446744073709551615 ts=0:00:00.184021844<br>
> <br>
> (*) Does this very high max value screw up the statistis?<br>
> <br>
>       0x503fc0.rtpjpegdepay0: min=0 max=0 ts=0:00:00.184053451<br>
>       0x51eba0.vaapidecode_jpeg0: min=80000000 max=0 ts=0:00:00.184074524<br>
> <br>
> Some of the figures above a really confusing.<br>
> <br>
>> Depending on the display rate, and considering you likely have a compositer,<br>
>> you'll have about 1.5 vblank latency duration added to your glass to glass<br>
>> latency. vaapisink maybe use more HW blocks, so there might be some latency<br>
>> added there too (I'm not too wail informed on tha taspect).<br>
> <br>
> The display runs at 60 Hz, hence 25 ms vblank latency. I'm using X11 and<br>
> the Matchbox Window manager. Can I avoid or improve the vblank latency<br>
> somehow? The latency is not really better if I use "kmssink" (without <br>
> X11).<br>
> <br>
>> There is an extra 15ms added in the vieo sink, see processing-deadline. In your<br>
>> case, I assume it should have 33ms latency + processing time, so you have about<br>
>> 7ms of processing time.<br>
>><br>
>>><br>
>>>   0:00:08.447955233   411       0x4d3c00 TRACE             GST_TRACER :0::<br>
>>> latency, src-element-id=(string)0x4f03a0, src-element=(string)udpsrc0,<br>
>>> src=(string)src, sink-element-id=(string)0x51acc0, sink-element=<br>
>>> (string)vaapisink0, sink=(string)sink, time=(guint64)41801197,<br>
>>> ts=(guint64)8447919094;<br>
>>>   0:00:08.481356539   411       0x4d3c00 TRACE             GST_TRACER :0::<br>
>>> latency, src-element-id=(string)0x4f03a0, src-element=(string)udpsrc0,<br>
>>> src=(string)src, sink-element-id=(string)0x51acc0, sink-element=<br>
>>> (string)vaapisink0, sink=(string)sink, time=(guint64)41875079,<br>
>>> ts=(guint64)8481323375;<br>
>>>   0:00:08.514592194   411       0x4d3c00 TRACE             GST_TRACER :0::<br>
>>> latency, src-element-id=(string)0x4f03a0, src-element=(string)udpsrc0,<br>
>>> src=(string)src, sink-element-id=(string)0x51acc0, sink-element=<br>
>>> (string)vaapisink0, sink=(string)sink, time=(guint64)41766241,<br>
>>> ts=(guint64)8514557403;<br>
>>><br>
>>> I wonder what is responsible for the 90 ms extra latency. Of course, the<br>
>>> camera and the network introduces some latency, but if I use MPV<br>
>>> instead,<br>
>>><br>
>>>   # mpv --profile=low-latency --untimed jpeg.sdp<br>
>>><br>
>>> I measure just 80 ms. Still a difference of 50 ms. Any idea where that<br>
>>> comes from?<br>
> <br>
> Still puzzled why "mpv" does a much better job here (50 ms less latency!).<br>
> <br>
> Wolfgang<br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
> <br>
> <br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div></div></div>