ff_lock_avcodec: make the lock state be consistent in case of failure.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-12-06 02:21:11 +01:00
parent 2dec950f49
commit 7885fa7685
1 changed files with 2 additions and 0 deletions

View File

@ -2555,6 +2555,8 @@ int ff_lock_avcodec(AVCodecContext *log_ctx)
entangled_thread_counter++; entangled_thread_counter++;
if (entangled_thread_counter != 1) { if (entangled_thread_counter != 1) {
av_log(log_ctx, AV_LOG_ERROR, "Insufficient thread locking around avcodec_open/close()\n"); av_log(log_ctx, AV_LOG_ERROR, "Insufficient thread locking around avcodec_open/close()\n");
ff_avcodec_locked = 1;
ff_unlock_avcodec();
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
av_assert0(!ff_avcodec_locked); av_assert0(!ff_avcodec_locked);