X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fpthread.c;h=75168e4598deeda1df4092b6f322d1db6f64c719;hb=5c15b78e4a47c46de03d5e7291ed19a717f36885;hp=dae28e6f5e6faaddc9eb90f4f5d5108b7c298f33;hpb=7c5ce99bd92fb480b7235cbc9a005f7e6d31f1d7;p=ffmpeg diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index dae28e6f5e6..75168e4598d 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -6,20 +6,20 @@ * to Michael Niedermayer for writing initial * implementation. * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -38,6 +38,8 @@ #include #elif HAVE_W32THREADS #include "w32pthreads.h" +#elif HAVE_OS2THREADS +#include "os2threads.h" #endif typedef int (action_func)(AVCodecContext *c, void *arg); @@ -363,6 +365,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, } if (for_user) { + dst->delay = src->thread_count - 1; dst->coded_frame = src->coded_frame; } else { if (dst->codec->update_thread_context) @@ -608,6 +611,10 @@ void ff_thread_finish_setup(AVCodecContext *avctx) { if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return; + if(p->state == STATE_SETUP_FINISHED){ + av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n"); + } + pthread_mutex_lock(&p->progress_mutex); p->state = STATE_SETUP_FINISHED; pthread_cond_broadcast(&p->progress_cond); @@ -810,6 +817,8 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) f->owner = avctx; + ff_init_buffer_info(avctx, f); + if (!(avctx->active_thread_type&FF_THREAD_FRAME)) { f->thread_opaque = NULL; return avctx->get_buffer(avctx, f);