<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>That’s is why on MJPEG there is no latency ?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Frame N doesn’t depend on N-1 nor N+1 so  each thread is independent ?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De :</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> libav-user-bounces@ffmpeg.org [mailto:libav-user-bounces@ffmpeg.org] <b>De la part de</b> Robin Stevens<br><b>Envoyé :</b> mardi 10 février 2015 10:33<br><b>À :</b> This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.<br><b>Objet :</b> Re: [Libav-user] Real time camera IP RTSP H264<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><br><br>On Tuesday, February 10, 2015, Maziar Mehrabi <<a href="mailto:maziar.mehrabi@gmail.com">maziar.mehrabi@gmail.com</a>> wrote:<o:p></o:p></p><div><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hi,<o:p></o:p></p></div><p class=MsoNormal>I wonder why multithreading causes latency.<o:p></o:p></p></div><p class=MsoNormal>My understanding is that having concurrent threads should improve performance.<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>Is there any explanation for this?<o:p></o:p></p></div><p class=MsoNormal>Thanks,<o:p></o:p></p><div><div><p class=MsoNormal><o:p> </o:p></p></div></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Without any knowledge of the code in question: concurrency can increase overall throughput (for particular kinds of task) but increased latency is a common payoff.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Imagine each thread as a separate decoder with carefully controlled access to some common data/state. To fully decode the Nth frame probably requires at least a partial decode (possibly a complete decode) of the N-1 frame. Therefore although the decoding for the Nth frame may happen on a separate processor core, it's likely not truly independent of the other cores.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>So if you have 4 threads, T4 is waiting on T3, which is waiting on T2 and on T1. Even though T1 may have finished frame 1, it probably can't fully decode frame 5 until 4 is available from T4...<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>But that's just my guess!<o:p></o:p></p></div></div>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
        <tr>
                <td style='border:none;padding:0px 15px 0px 8px'>
                        <a href="http://www.avast.com/">
                                <img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
                        </a>
                </td>
                <td>
                        <p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
                                Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection <a href="http://www.avast.com/">Antivirus avast!</a> est active.
                        </p>
                </td>
        </tr>
</table>
<br />
</body></html>