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

Function validate_thread_parameters

libavcodec/pthread.c:49–70  ·  view source on GitHub ↗

* Set the threading algorithms used. * * Threading requires more than one thread. * Frame threading requires entire frames to be passed to the codec, * and introduces extra decoding delay, so is incompatible with low_delay. * * @param avctx The context. */

Source from the content-addressed store, hash-verified

47 * @param avctx The context.
48 */
49static av_cold void validate_thread_parameters(AVCodecContext *avctx)
50{
51 int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)
52 && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
53 && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS);
54 if (avctx->thread_count == 1) {
55 avctx->active_thread_type = 0;
56 } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {
57 avctx->active_thread_type = FF_THREAD_FRAME;
58 } else if (avctx->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS &&
59 avctx->thread_type & FF_THREAD_SLICE) {
60 avctx->active_thread_type = FF_THREAD_SLICE;
61 } else if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_AUTO_THREADS)) {
62 avctx->thread_count = 1;
63 avctx->active_thread_type = 0;
64 }
65
66 if (avctx->thread_count > MAX_AUTO_THREADS)
67 av_log(avctx, AV_LOG_WARNING,
68 "Application has requested %d threads. Using a thread count greater than %d is not recommended.\n",
69 avctx->thread_count, MAX_AUTO_THREADS);
70}
71
72av_cold int ff_thread_init(AVCodecContext *avctx)
73{

Callers 1

ff_thread_initFunction · 0.85

Calls 2

ffcodecFunction · 0.85
av_logFunction · 0.85

Tested by

no test coverage detected