diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-05 23:46:59 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-06 02:51:26 +0100 |
commit | d7169280a64964b90cab6d1e87725fd36605ff85 (patch) | |
tree | 927542786855b1fe7243888ab541b4c7905dabf2 /libavcodec/utils.c | |
parent | bde6f6eadc24b372c12da2894f2ee0b86b5ff6a3 (diff) | |
download | ffmpeg-d7169280a64964b90cab6d1e87725fd36605ff85.tar.gz |
frame_thread_encoder: fix locking while locks are held
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f9b0156c26..fc56d69b31 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -898,9 +898,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS) { - entangled_thread_counter--; //we will instanciate a few encoders thus kick the counter to prevent false detection of a problem + ff_unlock_avcodec(); //we will instanciate a few encoders thus kick the counter to prevent false detection of a problem ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL); - entangled_thread_counter++; + ff_lock_avcodec(avctx); if (ret < 0) goto free_and_end; } @@ -1874,9 +1874,9 @@ av_cold int avcodec_close(AVCodecContext *avctx) if (avcodec_is_open(avctx)) { if (HAVE_THREADS && avctx->internal->frame_thread_encoder && avctx->thread_count > 1) { - entangled_thread_counter --; + ff_unlock_avcodec(); ff_frame_thread_encoder_free(avctx); - entangled_thread_counter ++; + ff_lock_avcodec(avctx); } if (HAVE_THREADS && avctx->thread_opaque) ff_thread_free(avctx); |