[FFmpeg-cvslog] avcodec/cri: Make decoder init-threadsafe
Andreas Rheinhardt
git at videolan.org
Fri Dec 4 17:40:56 EET 2020
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Nov 26 23:59:39 2020 +0100| [ba96cdd551e7bf938ae8af90e14498edd09ee71a] | committer: Andreas Rheinhardt
avcodec/cri: Make decoder init-threadsafe
The only thing that stands in the way of adding the
FF_CODEC_CAP_INIT_THREADSAFE flag to the Cintel RAW decoder is its usage
of ff_codec_open2_recursive(): This function requires its caller to hold
the lock for the mutex that guards initialization of AVCodecContexts
whose codecs have a non-threadsafe init function and only callers whose
codec does not have the FF_CODEC_CAP_INIT_THREADSAFE flag set hold said
lock (the others don't need to care about said lock). But one can set
the flag if one switches to avcodec_open2() at the same time.
Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ba96cdd551e7bf938ae8af90e14498edd09ee71a
---
libavcodec/cri.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/cri.c b/libavcodec/cri.c
index dafbc1f1be..5234f49965 100644
--- a/libavcodec/cri.c
+++ b/libavcodec/cri.c
@@ -66,7 +66,7 @@ static av_cold int cri_decode_init(AVCodecContext *avctx)
s->jpeg_avctx->flags2 = avctx->flags2;
s->jpeg_avctx->dct_algo = avctx->dct_algo;
s->jpeg_avctx->idct_algo = avctx->idct_algo;
- ret = ff_codec_open2_recursive(s->jpeg_avctx, codec, NULL);
+ ret = avcodec_open2(s->jpeg_avctx, codec, NULL);
if (ret < 0)
return ret;
@@ -419,6 +419,6 @@ AVCodec ff_cri_decoder = {
.decode = cri_decode_frame,
.close = cri_decode_close,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
- .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.long_name = NULL_IF_CONFIG_SMALL("Cintel RAW"),
};
More information about the ffmpeg-cvslog
mailing list