[FFmpeg-devel] [PATCH] lavc/vaapi_encode: reconfigure sequence parameter in case it changes

Linjie Fu linjie.fu at intel.com
Wed Nov 13 14:11:00 EET 2019


Aspect ratio change should be preserved in the output result of
transcoding. A better choice is to reconfigure when parameter changing
is detected, but a fix to reconfigure on IDR frame is simple and effective
with no performance drop.

Fix #6276 for VAAPI.

Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
 libavcodec/vaapi_encode.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 3be9159d37..c202113cb9 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -226,6 +226,12 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
     pic->nb_param_buffers = 0;
 
     if (pic->type == PICTURE_TYPE_IDR && ctx->codec->init_sequence_params) {
+        err = ctx->codec->init_sequence_params(avctx);
+        if (err < 0) {
+            av_log(avctx, AV_LOG_ERROR, "Failed to reinit per-sequence "
+            "parameters: %d.\n", err);
+            goto fail;
+        }
         err = vaapi_encode_make_param_buffer(avctx, pic,
                                              VAEncSequenceParameterBufferType,
                                              ctx->codec_sequence_params,
-- 
2.17.1



More information about the ffmpeg-devel mailing list