diff options
author | Stefan Schoenefeld <sschoenefeld@nvidia.com> | 2019-08-02 09:18:10 +0000 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2019-08-04 16:11:53 +0200 |
commit | 39a5c0ac0651113750d01f3ee6bcf3819de3d7ee (patch) | |
tree | 6325e53187a33d9d2b1b47841ec78d4f67201b61 /libavcodec/sp5xdec.c | |
parent | 9af8ce754b705c36ad4d2b6fd0f73f87ca4381c4 (diff) | |
download | ffmpeg-39a5c0ac0651113750d01f3ee6bcf3819de3d7ee.tar.gz |
avcodec/h263dec: fix hwaccel decoding
Recently we encountered an issue when decoding a h.263 file:
FFmpeg will freeze when decoding h.263 video with NVDEC. Turns out this is not directly related to NVDEC but is a problem that shows with several other HW decoders like VDPAU, though the exact kind of error is different (either error messages or freezing[1]). The root cause is that ff_thread_finish_setup() is called twice per frame from ff_h263_decode_frame(). This is not supported by ff_thread_finish_setup() and specifically checked for and warned against in the functions code. The issue is also specific to hw accelerated decoding only as the second call to ff_thread_finish_setup() is only issued when hw acceleration is on. The fix is simple: add a check that the first call is only send when hw acceleration is off, and the second call only when hw acceleration is on (see attached patch). This works fine as far as I was able to test with vdpau and nvdec/nvcuvid hw decoding. The patch also adds NVDEC to the hw config list if available.
I also noticed a secondary issue when browsing through the code which is that, according to documentation, ff_thread_finish_setup() should only be called if the codec implements update_thread_context(), which h263dec does not. The patch does not address this and I'm not sure any action needs to be taken here at all.
[1] This is depending on whether or not the hw decoder sets the HWACCEL_CAPS_ASYNC_SAFE flag
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/sp5xdec.c')
0 files changed, 0 insertions, 0 deletions