| 273 | } |
| 274 | |
| 275 | av_cold void ff_frame_thread_encoder_free(AVCodecContext *avctx) |
| 276 | { |
| 277 | ThreadContext *c= avctx->internal->frame_thread_encoder; |
| 278 | |
| 279 | /* In case initializing the mutexes/condition variables failed, |
| 280 | * they must not be used. In this case the thread_count is zero |
| 281 | * as no thread has been initialized yet. */ |
| 282 | if (avctx->thread_count > 0) { |
| 283 | pthread_mutex_lock(&c->task_fifo_mutex); |
| 284 | atomic_store(&c->exit, 1); |
| 285 | pthread_cond_broadcast(&c->task_fifo_cond); |
| 286 | pthread_mutex_unlock(&c->task_fifo_mutex); |
| 287 | |
| 288 | for (int i = 0; i < avctx->thread_count; i++) |
| 289 | pthread_join(c->worker[i], NULL); |
| 290 | } |
| 291 | |
| 292 | for (unsigned i = 0; i < c->max_tasks; i++) { |
| 293 | av_frame_free(&c->tasks[i].indata); |
| 294 | av_packet_free(&c->tasks[i].outdata); |
| 295 | } |
| 296 | |
| 297 | ff_pthread_free(c, thread_ctx_offsets); |
| 298 | av_freep(&avctx->internal->frame_thread_encoder); |
| 299 | } |
| 300 | |
| 301 | int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt, |
| 302 | AVFrame *frame, int *got_packet_ptr) |
no test coverage detected