diff options
author | Anatoliy Wasserman <anatoliy.wasserman@yandex.ru> | 2011-12-07 14:14:49 -0800 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-08 02:01:21 +0100 |
commit | 6778f9d9f225cd9ec33ac49a5ec29f3542f980c8 (patch) | |
tree | 2eb8a177f08d80bcfc0f504a4fe1831a12ddd5b9 /libavcodec | |
parent | ec8a3e25d8cfed9f8f335b88d8162ae331b68df9 (diff) | |
download | ffmpeg-6778f9d9f225cd9ec33ac49a5ec29f3542f980c8.tar.gz |
pthread: fixed thread initialization issues related to thread-safe buffer allocator
Signed-off-by: Anatoliy Wasserman <anatoliy.wasserman@yandex.ru>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libopenjpegdec.c | 2 | ||||
-rw-r--r-- | libavcodec/pthread.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index baa516b66b..ca3ef5f842 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -241,8 +241,6 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, return -1; } - ff_thread_finish_setup(avctx); - ctx->dec_params.cp_limit_decoding = NO_LIMITATION; ctx->dec_params.cp_reduce = avctx->lowres; // Tie decoder with decoding parameters diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 8aac89fa24..2154163c10 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -301,7 +301,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg) if (fctx->die) break; - if (!codec->update_thread_context && avctx->thread_safe_callbacks) + if (!codec->update_thread_context && (avctx->thread_safe_callbacks || avctx->get_buffer == avcodec_default_get_buffer)) ff_thread_finish_setup(avctx); pthread_mutex_lock(&p->mutex); @@ -403,6 +403,7 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src) dst->frame_number = src->frame_number; dst->reordered_opaque = src->reordered_opaque; + dst->thread_safe_callbacks = src->thread_safe_callbacks; #undef copy_fields } @@ -828,7 +829,8 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) } if (p->state != STATE_SETTING_UP && - (avctx->codec->update_thread_context || !avctx->thread_safe_callbacks)) { + (avctx->codec->update_thread_context || (!avctx->thread_safe_callbacks && + avctx->get_buffer != avcodec_default_get_buffer))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } |