Revision ad9791e1 libavcodec/pthread.c

View differences:

libavcodec/pthread.c
292 292

  
293 293
        if (fctx->die) break;
294 294

  
295
        if (!codec->update_thread_context) ff_thread_finish_setup(avctx);
295
        if (!codec->update_thread_context && avctx->thread_safe_callbacks)
296
            ff_thread_finish_setup(avctx);
296 297

  
297 298
        pthread_mutex_lock(&p->mutex);
298 299
        avcodec_get_frame_defaults(&p->frame);
......
779 780
        return avctx->get_buffer(avctx, f);
780 781
    }
781 782

  
782
    if (p->state != STATE_SETTING_UP) {
783
    if (p->state != STATE_SETTING_UP &&
784
        (avctx->codec->update_thread_context || !avctx->thread_safe_callbacks)) {
783 785
        av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n");
784 786
        return -1;
785 787
    }
......
810 812
        err = p->result;
811 813

  
812 814
        pthread_mutex_unlock(&p->progress_mutex);
815

  
816
        if (!avctx->codec->update_thread_context)
817
            ff_thread_finish_setup(avctx);
813 818
    }
814 819

  
815 820
    pthread_mutex_unlock(&p->parent->buffer_mutex);

Also available in: Unified diff