diff options
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r-- | libavcodec/pthread.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 7557e68c65..9fe9b8d784 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -31,6 +31,7 @@ #include "config.h" #include "avcodec.h" +#include "internal.h" #include "thread.h" #if HAVE_PTHREADS @@ -672,8 +673,10 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count) pthread_cond_destroy(&p->output_cond); av_freep(&p->avpkt.data); - if (i) + if (i) { av_freep(&p->avctx->priv_data); + av_freep(&p->avctx->internal); + } av_freep(&p->avctx); } @@ -728,9 +731,15 @@ static int frame_thread_init(AVCodecContext *avctx) update_context_from_thread(avctx, copy, 1); } else { - copy->is_copy = 1; copy->priv_data = av_malloc(codec->priv_data_size); memcpy(copy->priv_data, src->priv_data, codec->priv_data_size); + copy->internal = av_malloc(sizeof(AVCodecInternal)); + if (!copy->internal) { + err = AVERROR(ENOMEM); + goto error; + } + *(copy->internal) = *(src->internal); + copy->internal->is_copy = 1; if (codec->init_thread_copy) err = codec->init_thread_copy(copy); @@ -862,8 +871,7 @@ void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f) } if(avctx->debug & FF_DEBUG_BUFFERS) - av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p, %d buffers used\n", - f, f->owner->internal_buffer_count); + av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p\n", f); fctx = p->parent; pthread_mutex_lock(&fctx->buffer_mutex); |