]> git.sesse.net Git - ffmpeg/commit
avcodec/avcodec: Store whether AVCodec->close needs to be called
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Sun, 18 Apr 2021 05:01:22 +0000 (07:01 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Wed, 28 Apr 2021 00:03:15 +0000 (02:03 +0200)
commit29f5c1e51b0d156f4650b96ab56c07727fe9a9b7
tree2a52147902168fb65a3de28baddd76cdac0e11a0
parentd07534b5f5f20b4f780f5b0284aca6354da00695
avcodec/avcodec: Store whether AVCodec->close needs to be called

Right now all AVCodecContexts except those using frame-threaded decoding
call the codec's init function and expect its close function to be
called. In order to make sure that the close function is not called for
frame-threaded decoding ff_frame_thread_free() resets
AVCodecContext.codec (and because of this it has to free the private
AVOptions of the main AVCodecContext itself). This is not obvious and
potentially fragile. Instead add a field to AVCodecInternal that
indicates whether close should be called for this AVCodecContext.
It is always zero when using frame-threaded decoding, so that resetting
the codec is no longer necessary and has been removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/avcodec.c
libavcodec/internal.h
libavcodec/pthread_frame.c