| 1019 | } |
| 1020 | |
| 1021 | static int thread_get_buffer_internal(AVCodecContext *avctx, AVFrame *f, int flags) |
| 1022 | { |
| 1023 | PerThreadContext *p; |
| 1024 | int err; |
| 1025 | |
| 1026 | if (!(avctx->active_thread_type & FF_THREAD_FRAME)) |
| 1027 | return ff_get_buffer(avctx, f, flags); |
| 1028 | |
| 1029 | p = avctx->internal->thread_ctx; |
| 1030 | if (atomic_load(&p->state) != STATE_SETTING_UP && |
| 1031 | ffcodec(avctx->codec)->update_thread_context) { |
| 1032 | av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); |
| 1033 | return -1; |
| 1034 | } |
| 1035 | |
| 1036 | pthread_mutex_lock(&p->parent->buffer_mutex); |
| 1037 | err = ff_get_buffer(avctx, f, flags); |
| 1038 | |
| 1039 | pthread_mutex_unlock(&p->parent->buffer_mutex); |
| 1040 | |
| 1041 | return err; |
| 1042 | } |
| 1043 | |
| 1044 | int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags) |
| 1045 | { |
no test coverage detected