avdec: better multi-threaded decoding performance for live pipelines where downstream does not sync to clock
Submitted by Tim Müller
Currently we always use FF_THREAD_SLICE mode for multithreaded H.264 decoding.
This mode requires encoder support, so multiple threads will only be used if the H.264 video is encoded in a suitable way (i.e. with multiple slices per frame). This is not necessarily the case, and where this is not the case decoding will be done in a single thread only, hampering performance.
We should use FF_THREAD_SLICE only for live pipelines where latency is important, and use FF_THREAD_FRAME for decoding scenarios where latency does not matter, to make sure we actually use multiple threads for decoding if possible.