[Libav-user] Real time camera IP RTSP H264
rdstevens at gmail.com
Tue Feb 10 10:33:19 CET 2015
On Tuesday, February 10, 2015, Maziar Mehrabi <maziar.mehrabi at gmail.com>
> I wonder why multithreading causes latency.
> My understanding is that having concurrent threads should improve
> Is there any explanation for this?
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.
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.
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...
But that's just my guess!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user