diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2015-10-12 10:32:28 -0400 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-10-13 13:43:29 +0200 |
commit | 17e41cf3614973258c24aa2452215ef7e3bfa5ed (patch) | |
tree | cc659dd7b4d9ac941d3ba38408d06570a39eef79 /libavcodec | |
parent | 34ed5c2e4d9b7fe5c9b3aae2da5599fabb95c02e (diff) | |
download | ffmpeg-17e41cf3614973258c24aa2452215ef7e3bfa5ed.tar.gz |
avcodec: Do not lock during init if there is no init function
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a1aece7fd1..430926dc65 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -845,7 +845,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code av_dict_copy(&tmp, *options, 0); /* If there is a user-supplied mutex locking routine, call it. */ - if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)) { + if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) { if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; @@ -1086,7 +1086,7 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif } end: - if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)) { + if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) { entangled_thread_counter--; /* Release any user-supplied mutex. */ |