* 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. */
| 47 | * @param avctx The context. |
| 48 | */ |
| 49 | static 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 | |
| 72 | av_cold int ff_thread_init(AVCodecContext *avctx) |
| 73 | { |
no test coverage detected