avcodec/libaomenc: use ctx->usage to get default cfg

this prevents some mismatches in config values for realtime and all
intra modes, avoiding failures like:

[libaom-av1 @ ...] Failed to initialize encoder: Invalid parameter
[libaom-av1 @ ...]   Additional information: g_lag_in_frames out of
range [..0]

Signed-off-by: James Zern <jzern@google.com>
This commit is contained in:
James Zern 2021-08-13 19:00:50 -07:00
parent 7f194c7d96
commit cb23c1e553
2 changed files with 2 additions and 4 deletions

View File

@ -599,7 +599,7 @@ static av_cold int aom_init(AVCodecContext *avctx,
av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str());
av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config());
if ((res = aom_codec_enc_config_default(iface, &enccfg, 0)) != AOM_CODEC_OK) {
if ((res = aom_codec_enc_config_default(iface, &enccfg, ctx->usage)) != AOM_CODEC_OK) {
av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n",
aom_codec_err_to_string(res));
return AVERROR(EINVAL);
@ -623,8 +623,6 @@ static av_cold int aom_init(AVCodecContext *avctx,
enccfg.g_threads =
FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 64);
enccfg.g_usage = ctx->usage;
if (ctx->lag_in_frames >= 0)
enccfg.g_lag_in_frames = ctx->lag_in_frames;

View File

@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 59
#define LIBAVCODEC_VERSION_MINOR 5
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \