Commit e1b66778 authored by Anton Khirnov's avatar Anton Khirnov

lavc: remove the locking code in avcodec_close()

This function should not modify any global state, so there should be no
reason for any locking.
parent 584f8840
...@@ -1684,19 +1684,6 @@ void avsubtitle_free(AVSubtitle *sub) ...@@ -1684,19 +1684,6 @@ void avsubtitle_free(AVSubtitle *sub)
av_cold int avcodec_close(AVCodecContext *avctx) 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)) { if (avcodec_is_open(avctx)) {
FramePool *pool = avctx->internal->pool; FramePool *pool = avctx->internal->pool;
int i; int i;
...@@ -1725,12 +1712,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) ...@@ -1725,12 +1712,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_freep(&avctx->extradata); av_freep(&avctx->extradata);
avctx->codec = NULL; avctx->codec = NULL;
avctx->active_thread_type = 0; 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; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment