Commit 94b3a666 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/pthread: Make sure ff_thread_finish_setup() conditions match

Prevents warning from being shown due to multiple calls.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 32a6dfeb
...@@ -362,6 +362,9 @@ static int thread_init(AVCodecContext *avctx) ...@@ -362,6 +362,9 @@ static int thread_init(AVCodecContext *avctx)
return 0; return 0;
} }
#define THREAD_SAFE_CALLBACKS(avctx) \
((avctx)->thread_safe_callbacks || (!(avctx)->get_buffer && (avctx)->get_buffer2 == avcodec_default_get_buffer2))
/** /**
* Codec worker thread. * Codec worker thread.
* *
...@@ -383,11 +386,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg) ...@@ -383,11 +386,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
if (fctx->die) break; if (fctx->die) break;
if (!codec->update_thread_context && (avctx->thread_safe_callbacks || ( if (!codec->update_thread_context && THREAD_SAFE_CALLBACKS(avctx))
#if FF_API_GET_BUFFER
!avctx->get_buffer &&
#endif
avctx->get_buffer2 == avcodec_default_get_buffer2)))
ff_thread_finish_setup(avctx); ff_thread_finish_setup(avctx);
avcodec_get_frame_defaults(&p->frame); avcodec_get_frame_defaults(&p->frame);
...@@ -1026,7 +1025,7 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int ...@@ -1026,7 +1025,7 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
pthread_mutex_unlock(&p->progress_mutex); pthread_mutex_unlock(&p->progress_mutex);
} }
if (!avctx->thread_safe_callbacks && !avctx->codec->update_thread_context) if (!THREAD_SAFE_CALLBACKS(avctx) && !avctx->codec->update_thread_context)
ff_thread_finish_setup(avctx); ff_thread_finish_setup(avctx);
if (err) if (err)
......
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