summaryrefslogtreecommitdiff
path: root/libavcodec/pthread_frame.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-18 07:01:22 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-28 02:03:15 +0200
commit29f5c1e51b0d156f4650b96ab56c07727fe9a9b7 (patch)
tree2a52147902168fb65a3de28baddd76cdac0e11a0 /libavcodec/pthread_frame.c
parentd07534b5f5f20b4f780f5b0284aca6354da00695 (diff)
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>
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r--libavcodec/pthread_frame.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 78116e7e5a..2ff71ca39e 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -801,10 +801,6 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
free_pthread(fctx, thread_ctx_offsets);
av_freep(&avctx->internal->thread_ctx);
-
- if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
- av_opt_free(avctx->priv_data);
- avctx->codec = NULL;
}
static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,