[FFmpeg-cvslog] avcodec/nvenc: move reconfig_encoder call inside of push/pop ctx

Timo Rothenpieler git at videolan.org
Sat May 5 01:16:07 EEST 2018


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Thu May  3 18:57:40 2018 +0200| [fdbb4b9a7866919e58212d3927ca47528235d847] | committer: Timo Rothenpieler

avcodec/nvenc: move reconfig_encoder call inside of push/pop ctx

Also make it void, it must not fail the encode anyway.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fdbb4b9a7866919e58212d3927ca47528235d847
---

 libavcodec/nvenc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index f3193f1cc7..d61955c03a 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1948,7 +1948,7 @@ static int output_ready(AVCodecContext *avctx, int flush)
     return (nb_ready > 0) && (nb_ready + nb_pending >= ctx->async_depth);
 }
 
-static int reconfig_encoder(AVCodecContext *avctx, const AVFrame *frame)
+static void reconfig_encoder(AVCodecContext *avctx, const AVFrame *frame)
 {
     NvencContext *ctx = avctx->priv_data;
     NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs;
@@ -2038,8 +2038,6 @@ static int reconfig_encoder(AVCodecContext *avctx, const AVFrame *frame)
 
         }
     }
-
-    return 0;
 }
 
 int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
@@ -2064,8 +2062,6 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
         return AVERROR_EOF;
 
     if (frame) {
-        reconfig_encoder(avctx, frame);
-
         in_surf = get_free_frame(ctx);
         if (!in_surf)
             return AVERROR(EAGAIN);
@@ -2074,6 +2070,8 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
         if (res < 0)
             return res;
 
+        reconfig_encoder(avctx, frame);
+
         res = nvenc_upload_frame(avctx, frame, in_surf);
 
         res2 = nvenc_pop_context(avctx);



More information about the ffmpeg-cvslog mailing list