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

Derek Buitenhuis git at videolan.org
Mon Oct 12 20:27:07 CEST 2015


ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Mon Oct 12 15:25:51 2015 -0300| [1156b634c18fcbaa0d107df8135578031242815c] | committer: James Almer

avcodec: Don't lock on init for codecs without an init function

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1156b634c18fcbaa0d107df8135578031242815c
---

 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);



More information about the ffmpeg-cvslog mailing list