]> git.sesse.net Git - ffmpeg/commitdiff
lavc: remove the locking code in avcodec_close()
authorAnton Khirnov <anton@khirnov.net>
Sat, 5 Apr 2014 05:09:44 +0000 (07:09 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 18 May 2014 08:16:35 +0000 (10:16 +0200)
This function should not modify any global state, so there should be no
reason for any locking.

libavcodec/utils.c

index d5c307042ec2bbc78408793b992d9d48cc4b4851..71cbc57b44814911982804cfc734c16d03b0b438 100644 (file)
@@ -1684,19 +1684,6 @@ void avsubtitle_free(AVSubtitle *sub)
 
 av_cold int avcodec_close(AVCodecContext *avctx)
 {
-    /* If there is a user-supplied mutex locking routine, call it. */
-    if (lockmgr_cb) {
-        if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
-            return -1;
-    }
-
-    entangled_thread_counter++;
-    if (entangled_thread_counter != 1) {
-        av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
-        entangled_thread_counter--;
-        return -1;
-    }
-
     if (avcodec_is_open(avctx)) {
         FramePool *pool = avctx->internal->pool;
         int i;
@@ -1725,12 +1712,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
         av_freep(&avctx->extradata);
     avctx->codec = NULL;
     avctx->active_thread_type = 0;
-    entangled_thread_counter--;
 
-    /* Release any user-supplied mutex. */
-    if (lockmgr_cb) {
-        (*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);
-    }
     return 0;
 }