This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit a6069092af2dbb0847de73636b3ee611f60307a8 Author: Marton Balint <[email protected]> AuthorDate: Sun Jan 11 18:50:56 2026 +0100 Commit: Marton Balint <[email protected]> CommitDate: Mon Jan 19 21:32:00 2026 +0000 avcodec/libvpxenc: log the error message from the correct encoder It is possible that the error happens with the alpha encoder, not the normal one, so let's always pass the affected encoder to the logging function. Signed-off-by: Marton Balint <[email protected]> --- libavcodec/libvpxenc.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index af73966141..082709c41f 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -202,15 +202,14 @@ static const char *const ctlidstr[] = { #endif }; -static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) +static av_cold void log_encoder_error(void *logctx, struct vpx_codec_ctx *encoder, const char *desc) { - VPxContext *ctx = avctx->priv_data; - const char *error = vpx_codec_error(&ctx->encoder); - const char *detail = vpx_codec_error_detail(&ctx->encoder); + const char *error = vpx_codec_error(encoder); + const char *detail = vpx_codec_error_detail(encoder); - av_log(avctx, AV_LOG_ERROR, "%s: %s\n", desc, error); + av_log(logctx, AV_LOG_ERROR, "%s: %s\n", desc, error); if (detail) - av_log(avctx, AV_LOG_ERROR, " Additional information: %s\n", detail); + av_log(logctx, AV_LOG_ERROR, " Additional information: %s\n", detail); } static av_cold void dump_enc_cfg(AVCodecContext *avctx, @@ -477,7 +476,7 @@ static av_cold int codecctl_int(AVCodecContext *avctx, if (res != VPX_CODEC_OK) { snprintf(buf, sizeof(buf), "Failed to set %s codec control", ctlidstr[id]); - log_encoder_error(avctx, buf); + log_encoder_error(avctx, &ctx->encoder, buf); return AVERROR(EINVAL); } @@ -486,7 +485,7 @@ static av_cold int codecctl_int(AVCodecContext *avctx, if (res_alpha != VPX_CODEC_OK) { snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control", ctlidstr[id]); - log_encoder_error(avctx, buf); + log_encoder_error(avctx, &ctx->encoder_alpha, buf); return AVERROR(EINVAL); } } @@ -510,7 +509,7 @@ static av_cold int codecctl_intp(AVCodecContext *avctx, if (res != VPX_CODEC_OK) { snprintf(buf, sizeof(buf), "Failed to set %s codec control", ctlidstr[id]); - log_encoder_error(avctx, buf); + log_encoder_error(avctx, &ctx->encoder, buf); return AVERROR(EINVAL); } @@ -519,7 +518,7 @@ static av_cold int codecctl_intp(AVCodecContext *avctx, if (res_alpha != VPX_CODEC_OK) { snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control", ctlidstr[id]); - log_encoder_error(avctx, buf); + log_encoder_error(avctx, &ctx->encoder_alpha, buf); return AVERROR(EINVAL); } } @@ -1183,7 +1182,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, res = vpx_codec_enc_init(&ctx->encoder, iface, &enccfg, flags); if (res != VPX_CODEC_OK) { dump_enc_cfg(avctx, &enccfg, AV_LOG_WARNING); - log_encoder_error(avctx, "Failed to initialize encoder"); + log_encoder_error(avctx, &ctx->encoder, "Failed to initialize encoder"); return AVERROR(EINVAL); } dump_enc_cfg(avctx, &enccfg, AV_LOG_DEBUG); @@ -1207,7 +1206,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, enccfg_alpha = enccfg; res = vpx_codec_enc_init(&ctx->encoder_alpha, iface, &enccfg_alpha, flags); if (res != VPX_CODEC_OK) { - log_encoder_error(avctx, "Failed to initialize alpha encoder"); + log_encoder_error(avctx, &ctx->encoder_alpha, "Failed to initialize alpha encoder"); return AVERROR(EINVAL); } } @@ -1637,14 +1636,14 @@ static int vp9_encode_set_roi(AVCodecContext *avctx, int frame_width, int frame_ ret = set_roi_map(avctx, sd, frame_width, frame_height, &roi_map, block_size, segment_cnt); if (ret) { - log_encoder_error(avctx, "Failed to set_roi_map.\n"); + log_encoder_error(avctx, &ctx->encoder, "Failed to set_roi_map.\n"); return ret; } memset(roi_map.ref_frame, -1, sizeof(roi_map.ref_frame)); if (vpx_codec_control(&ctx->encoder, VP9E_SET_ROI_MAP, &roi_map)) { - log_encoder_error(avctx, "Failed to set VP9E_SET_ROI_MAP codec control.\n"); + log_encoder_error(avctx, &ctx->encoder, "Failed to set VP9E_SET_ROI_MAP codec control.\n"); ret = AVERROR_INVALIDDATA; } av_freep(&roi_map.roi_map); @@ -1669,12 +1668,12 @@ static int vp8_encode_set_roi(AVCodecContext *avctx, int frame_width, int frame_ int ret = set_roi_map(avctx, sd, frame_width, frame_height, &roi_map, block_size, segment_cnt); if (ret) { - log_encoder_error(avctx, "Failed to set_roi_map.\n"); + log_encoder_error(avctx, &ctx->encoder, "Failed to set_roi_map.\n"); return ret; } if (vpx_codec_control(&ctx->encoder, VP8E_SET_ROI_MAP, &roi_map)) { - log_encoder_error(avctx, "Failed to set VP8E_SET_ROI_MAP codec control.\n"); + log_encoder_error(avctx, &ctx->encoder, "Failed to set VP8E_SET_ROI_MAP codec control.\n"); ret = AVERROR_INVALIDDATA; } @@ -1729,7 +1728,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, cfg.rc_max_quantizer = avctx->qmax; res = vpx_codec_enc_config_set(&ctx->encoder, &cfg); if (res != VPX_CODEC_OK) { - log_encoder_error(avctx, "Error reconfiguring encoder"); + log_encoder_error(avctx, &ctx->encoder, "Error reconfiguring encoder"); return AVERROR_INVALIDDATA; } } @@ -1867,7 +1866,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp, duration, flags, ctx->deadline); if (res != VPX_CODEC_OK) { - log_encoder_error(avctx, "Error encoding frame"); + log_encoder_error(avctx, &ctx->encoder, "Error encoding frame"); return AVERROR_INVALIDDATA; } @@ -1875,7 +1874,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, res = vpx_codec_encode(&ctx->encoder_alpha, rawimg_alpha, timestamp, duration, flags, ctx->deadline); if (res != VPX_CODEC_OK) { - log_encoder_error(avctx, "Error encoding alpha frame"); + log_encoder_error(avctx, &ctx->encoder_alpha, "Error encoding alpha frame"); return AVERROR_INVALIDDATA; } } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
