[FFmpeg-devel] [PATCH] avcodec: Don't lock on init for codecs without an init function

Derek Buitenhuis derek.buitenhuis at gmail.com
Mon Oct 12 16:30:01 CEST 2015


Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
---
 libavcodec/utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1751067..0e4f3c0 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);
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list