diff mbox series

[FFmpeg-devel,2/2] lavc/libvpxenc: Show encoder config as a warning in case

Message ID 7dac021c-067e-3534-cedc-26799af1dd09@mail.de
State New
Headers show
Series [FFmpeg-devel,1/2] lavc/libaomenc: Show encoder config as a warning in case of failed initialization
Related show

Checks

Context Check Description
andriy/configure warning Failed to apply patch
andriy/configure warning Failed to apply patch

Commit Message

Thilo Borgmann June 12, 2021, 7:12 p.m. UTC
$subject

-Thilo
From 77ec6561c69bc35b338f92af551f277066f71b88 Mon Sep 17 00:00:00 2001
From: Matthieu Patou <mpatou@fb.com>
Date: Sat, 12 Jun 2021 21:01:40 +0200
Subject: [PATCH 2/2] lavc/libvpxenc: Show encoder config as a warning in case
 of failed initialization

Suggested-By: ffmpeg@fb.com
---
 libavcodec/libvpxenc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

James Zern June 14, 2021, 5:40 p.m. UTC | #1
On Sat, Jun 12, 2021 at 12:12 PM Thilo Borgmann <thilo.borgmann@mail.de> wrote:
>
> $subject
>

> ---
>  libavcodec/libvpxenc.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

lgtm. Same comment for the else as for libaomenc.c
diff mbox series

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 66bad444d0..16c68d8fee 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -190,10 +190,10 @@  static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
 }
 
 static av_cold void dump_enc_cfg(AVCodecContext *avctx,
-                                 const struct vpx_codec_enc_cfg *cfg)
+                                 const struct vpx_codec_enc_cfg *cfg,
+                                 int level)
 {
     int width = -30;
-    int level = AV_LOG_DEBUG;
     int i;
 
     av_log(avctx, level, "vpx_codec_enc_cfg\n");
@@ -860,7 +860,7 @@  static av_cold int vpx_init(AVCodecContext *avctx,
             return AVERROR(EINVAL);
         }
 
-    dump_enc_cfg(avctx, &enccfg);
+    dump_enc_cfg(avctx, &enccfg, AV_LOG_DEBUG);
 
     enccfg.g_w            = avctx->width;
     enccfg.g_h            = avctx->height;
@@ -1004,12 +1004,14 @@  static av_cold int vpx_init(AVCodecContext *avctx,
                    en->key, en->value);
     }
 
-    dump_enc_cfg(avctx, &enccfg);
     /* Construct Encoder Context */
     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");
         return AVERROR(EINVAL);
+    } else {
+        dump_enc_cfg(avctx, &enccfg, AV_LOG_DEBUG);
     }
 #if CONFIG_LIBVPX_VP9_ENCODER
     if (avctx->codec_id == AV_CODEC_ID_VP9 && enccfg.ts_number_layers > 1) {