diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-05-22 15:59:46 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-11-27 15:46:50 +0100 |
commit | a83098ab03a47179d54a9b9c8bcefc81b9c6aafd (patch) | |
tree | 3f12682fa2917e3e83b4a3a6459a4be9cf51210d /libavcodec/utils.c | |
parent | 551ca67afe7555368758c4aab476978689380a6d (diff) | |
download | ffmpeg-a83098ab03a47179d54a9b9c8bcefc81b9c6aafd.tar.gz |
avcodec: deprecate thread_safe_callbacks
They add considerable complexity to frame-threading implementation,
which includes an unavoidably leaking error path, while the advantages
of this option to the users are highly dubious.
It should be always possible and desirable for the callers to make their
get_buffer2() implementation thread-safe, so deprecate this option.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 9b074e2dda..3232a242c0 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -678,6 +678,19 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code goto free_and_end; } +#if FF_API_THREAD_SAFE_CALLBACKS +FF_DISABLE_DEPRECATION_WARNINGS + if ((avctx->thread_type & FF_THREAD_FRAME) && + avctx->get_buffer2 != avcodec_default_get_buffer2 && + !avctx->thread_safe_callbacks) { + av_log(avctx, AV_LOG_WARNING, "Requested frame threading with a " + "custom get_buffer2() implementation which is not marked as " + "thread safe. This is not supported anymore, make your " + "callback thread-safe.\n"); + } +FF_ENABLE_DEPRECATION_WARNINGS +#endif + avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == AV_CODEC_ID_NONE) { |