[FFmpeg-devel] Fwd: [PATCH] avcodec: allow hardware decoding with multithread for FFmpeg

Stève Lhomme robux4 at videolabs.io
Thu Jul 28 10:39:14 EEST 2016

On Wed, Jul 27, 2016 at 7:58 PM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> On Wed, Jul 27, 2016 at 6:43 PM, Stève Lhomme <robux4 at videolabs.io> wrote:
>> Hello fellow FFmpegers,
>> Is there still an issue with hardware decoding when combined with
>> multithread ? It seems to work fine on our Windows build. Although we
>> have a mutex in place in the D3D11 variant of the code that may help.
>> It mostly protects the video context...
>> If necessary we can have the same trick for DXVA2 if there are still
>> known issues.
> ffmpeg.c just produces corrupt decoding when you try to use that, so
> use at your own peril.

Is it random or pretty easy to get the issue ? I'd certainly like to
understand the issue better.

With D3D11 we were using the decoder context in the decoder threads
and the vout thread. In debug builds Windows was complaining with
various warnings about that. On some phones it was even crashing.
After protecting the context in the libavcodec and the vout everything
seems to work fine. Is there anything else that would explain issues ?
Maybe Linux or Mac don't detect such cross accesses and that's how
corruption happens ?

> Not to mention that it doesn't offer any performance benefits.

libavcodec can decode multiple frames in parallel why couldn't the GPU
do it as well ? It would be odd that GPU based solutions are inferior
to CPU based ones.

Last but not least, why is it considered ok to use multiple threads in
libav and not in FFmpeg ? The code is pretty much the same for GPU

> - Hendrik
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

More information about the ffmpeg-devel mailing list