aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2015-10-12 15:25:51 -0300
committerJames Almer <jamrial@gmail.com>2015-10-12 15:25:51 -0300
commit1156b634c18fcbaa0d107df8135578031242815c (patch)
tree6cee5a9aa248391650b78c97a417a82b667490c5 /libavcodec/utils.c
parentccd3b3df39de4c2c4e30fb2012675f99e56dbc5e (diff)
downloadffmpeg-1156b634c18fcbaa0d107df8135578031242815c.tar.gz
avcodec: Don't lock on init for codecs without an init function
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 175106714d..0e4f3c0964 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3266,7 +3266,7 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
{
- if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)
+ if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init)
return 0;
if (lockmgr_cb) {
@@ -3292,7 +3292,7 @@ int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
int ff_unlock_avcodec(const AVCodec *codec)
{
- if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)
+ if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init)
return 0;
av_assert0(ff_avcodec_locked);