[FFmpeg-devel] [PATCH 05/10] lavc/libopenh264enc: prompt slice number changing according to cpus

Anton Khirnov anton at khirnov.net
Fri Apr 10 13:23:10 EEST 2020


Quoting Linjie Fu (2020-04-06 13:14:48)
> Libopenh264enc would set the slice according to the number of cpu cores
> if uiSliceNum equals to 0 (auto) in SM_FIXEDSLCNUM_SLICE mode.
> 
> Prompt a warning for user to catch this.
> 
> Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> ---
>  libavcodec/libopenh264enc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index dab8244..01a85fb 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -237,6 +237,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>      param.sSpatialLayers[0].sSliceCfg.uiSliceMode               = s->slice_mode;
>      param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = avctx->slices;
>  #endif
> +    if (avctx->slices == 0 && s->slice_mode == SM_FIXEDSLCNUM_SLICE)
> +        av_log(avctx, AV_LOG_WARNING, "Auto slice number, "
> +               "default to use the number of CPU cores: %d\n", av_cpu_count());

Generally makes sense, but I'd avoid the call to av_cpu_count() since we
don't know what method precisely will libopenh264 use to set the slice
count. So IMO just say something like "slice count will be set
automatically".

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list