Merge commit 'e1b66778b6ee82a192b5895e23c4e135f7269326'

* commit 'e1b66778b6ee82a192b5895e23c4e135f7269326':
  lavc: remove the locking code in avcodec_close()

Conflicts:
	libavcodec/utils.c

Note, if someone knows of a external codec lib/API, hwaccel or other that requires
locking on its close/free side, please contact ffmpeg-devel.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-05-18 12:46:28 +02:00
commit ff17d8b56e

View File

@ -2671,33 +2671,22 @@ av_cold int ff_codec_close_recursive(AVCodecContext *avctx)
{ {
int ret = 0; int ret = 0;
ff_unlock_avcodec();
ret = avcodec_close(avctx); ret = avcodec_close(avctx);
ff_lock_avcodec(NULL);
return ret; return ret;
} }
av_cold int avcodec_close(AVCodecContext *avctx) av_cold int avcodec_close(AVCodecContext *avctx)
{ {
int ret;
if (!avctx) if (!avctx)
return 0; return 0;
ret = ff_lock_avcodec(avctx);
if (ret < 0)
return ret;
if (avcodec_is_open(avctx)) { if (avcodec_is_open(avctx)) {
FramePool *pool = avctx->internal->pool; FramePool *pool = avctx->internal->pool;
int i; int i;
if (CONFIG_FRAME_THREAD_ENCODER && if (CONFIG_FRAME_THREAD_ENCODER &&
avctx->internal->frame_thread_encoder && avctx->thread_count > 1) { avctx->internal->frame_thread_encoder && avctx->thread_count > 1) {
ff_unlock_avcodec();
ff_frame_thread_encoder_free(avctx); ff_frame_thread_encoder_free(avctx);
ff_lock_avcodec(avctx);
} }
if (HAVE_THREADS && avctx->internal->thread_ctx) if (HAVE_THREADS && avctx->internal->thread_ctx)
ff_thread_free(avctx); ff_thread_free(avctx);
@ -2727,7 +2716,6 @@ av_cold int avcodec_close(AVCodecContext *avctx)
avctx->codec = NULL; avctx->codec = NULL;
avctx->active_thread_type = 0; avctx->active_thread_type = 0;
ff_unlock_avcodec();
return 0; return 0;
} }