MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_frame_thread_encoder_free

Function ff_frame_thread_encoder_free

libavcodec/frame_thread_encoder.c:275–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275av_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
301int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
302 AVFrame *frame, int *got_packet_ptr)

Callers 2

ff_codec_closeFunction · 0.85

Calls 8

av_frame_freeFunction · 0.85
av_packet_freeFunction · 0.85
ff_pthread_freeFunction · 0.85
av_freepFunction · 0.85
pthread_mutex_lockFunction · 0.50
pthread_cond_broadcastFunction · 0.50
pthread_mutex_unlockFunction · 0.50
pthread_joinFunction · 0.50

Tested by

no test coverage detected